Building from profiles now almost works

This commit is contained in:
jamesagnew 2014-03-03 09:05:55 -05:00
parent 7926387786
commit 0320d40bc1
52 changed files with 77562 additions and 3996 deletions

View File

@ -34,6 +34,10 @@ public abstract class BaseRuntimeChildDefinition {
return null; return null;
} }
public Object getInstanceConstructorArguments() {
return null;
}
// public String getExtensionUrl() { // public String getExtensionUrl() {
// return null; // return null;
// } // }

View File

@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeSet;
import ca.uhn.fhir.model.api.ICompositeElement; import ca.uhn.fhir.model.api.ICompositeElement;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
@ -46,7 +47,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IComposite
public BaseRuntimeChildDefinition getChildByNameOrThrowDataFormatException(String theName) throws DataFormatException { public BaseRuntimeChildDefinition getChildByNameOrThrowDataFormatException(String theName) throws DataFormatException {
BaseRuntimeChildDefinition retVal = myNameToChild.get(theName); BaseRuntimeChildDefinition retVal = myNameToChild.get(theName);
if (retVal == null) { if (retVal == null) {
throw new DataFormatException("Unknown child name '" + theName + "' in element " + getName()); throw new DataFormatException("Unknown child name '" + theName + "' in element " + getName() + " - Valid names are: " + new TreeSet<String>(myNameToChild.keySet()));
} }
return retVal; return retVal;
} }

View File

@ -1,10 +1,13 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import java.lang.reflect.InvocationTargetException;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
public abstract class BaseRuntimeElementDefinition<T extends IElement> { public abstract class BaseRuntimeElementDefinition<T extends IElement> {
@ -28,12 +31,28 @@ public abstract class BaseRuntimeElementDefinition<T extends IElement> {
} }
public T newInstance() { public T newInstance() {
return newInstance(null);
}
public T newInstance(Object theArgument) {
try { try {
if (theArgument == null) {
return getImplementingClass().newInstance(); return getImplementingClass().newInstance();
}else {
return getImplementingClass().getConstructor(IValueSetEnumBinder.class).newInstance(theArgument);
}
} catch (InstantiationException e) { } catch (InstantiationException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e); throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e); throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} catch (IllegalArgumentException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} catch (InvocationTargetException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} catch (NoSuchMethodException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} catch (SecurityException e) {
throw new ConfigurationException("Failed to instantiate type:"+getImplementingClass().getName(), e);
} }
} }

View File

@ -4,6 +4,7 @@ import static org.apache.commons.lang3.StringUtils.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -26,6 +27,7 @@ import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IResourceBlock; import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
import ca.uhn.fhir.model.api.ResourceReference; import ca.uhn.fhir.model.api.ResourceReference;
import ca.uhn.fhir.model.api.annotation.Block; import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Child;
@ -37,6 +39,7 @@ import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.Narrative; import ca.uhn.fhir.model.api.annotation.Narrative;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.ICodedDatatype; import ca.uhn.fhir.model.primitive.ICodedDatatype;
@ -166,7 +169,6 @@ class ModelScanner {
} }
} }
private void scanBlock(Class<? extends IResourceBlock> theClass, Block theBlockDefinition) { private void scanBlock(Class<? extends IResourceBlock> theClass, Block theBlockDefinition) {
ourLog.debug("Scanning resource block class: {}", theClass.getName()); ourLog.debug("Scanning resource block class: {}", theClass.getName());
@ -219,14 +221,17 @@ class ModelScanner {
scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef); scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef);
} }
// while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < 0) { // while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() <
// BaseRuntimeDeclaredChildDefinition elementDef = orderToElementDef.remove(orderToElementDef.firstKey()); // 0) {
// if (elementDef.getElementName().equals("identifier")) { // BaseRuntimeDeclaredChildDefinition elementDef =
// orderToElementDef.put(theIdentifierOrder, elementDef); // orderToElementDef.remove(orderToElementDef.firstKey());
// } else { // if (elementDef.getElementName().equals("identifier")) {
// throw new ConfigurationException("Don't know how to handle element: " + elementDef.getElementName()); // orderToElementDef.put(theIdentifierOrder, elementDef);
// } // } else {
// } // throw new ConfigurationException("Don't know how to handle element: "
// + elementDef.getElementName());
// }
// }
TreeSet<Integer> orders = new TreeSet<Integer>(); TreeSet<Integer> orders = new TreeSet<Integer>();
orders.addAll(orderToElementDef.keySet()); orders.addAll(orderToElementDef.keySet());
@ -239,14 +244,15 @@ class ModelScanner {
} }
BaseRuntimeDeclaredChildDefinition nextExt = orderToExtensionDef.get(i); BaseRuntimeDeclaredChildDefinition nextExt = orderToExtensionDef.get(i);
if (nextExt != null) { if (nextExt != null) {
theDefinition.addExtension((RuntimeChildDeclaredExtensionDefinition)nextExt); theDefinition.addExtension((RuntimeChildDeclaredExtensionDefinition) nextExt);
} }
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void scanCompositeElementForChildren(Class<? extends ICompositeElement> theClass, BaseRuntimeElementCompositeDefinition<?> theDefinition, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef, TreeMap<Integer,BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) { private void scanCompositeElementForChildren(Class<? extends ICompositeElement> theClass, BaseRuntimeElementCompositeDefinition<?> theDefinition, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef,
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1; int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1;
for (Field next : theClass.getDeclaredFields()) { for (Field next : theClass.getDeclaredFields()) {
@ -323,7 +329,7 @@ class ModelScanner {
Class<? extends IElement> et = (Class<? extends IElement>) nextElementType; Class<? extends IElement> et = (Class<? extends IElement>) nextElementType;
RuntimeChildDeclaredExtensionDefinition def = new RuntimeChildDeclaredExtensionDefinition(next, min, max, elementName, extensionAttr.url(), et); RuntimeChildDeclaredExtensionDefinition def = new RuntimeChildDeclaredExtensionDefinition(next, min, max, elementName, extensionAttr.url(), et);
orderMap.put(order, def); orderMap.put(order, def);
if (IElement.class.isAssignableFrom(nextElementType )) { if (IElement.class.isAssignableFrom(nextElementType)) {
addScanAlso((Class<? extends IElement>) nextElementType); addScanAlso((Class<? extends IElement>) nextElementType);
} }
} else if (ResourceReference.class.isAssignableFrom(nextElementType)) { } else if (ResourceReference.class.isAssignableFrom(nextElementType)) {
@ -359,7 +365,12 @@ class ModelScanner {
addScanAlso(nextDatatype); addScanAlso(nextDatatype);
BaseRuntimeChildDatatypeDefinition def; BaseRuntimeChildDatatypeDefinition def;
if (IPrimitiveDatatype.class.isAssignableFrom(nextElementType)) { if (IPrimitiveDatatype.class.isAssignableFrom(nextElementType)) {
def = new RuntimeChildPrimitiveDatatypeDefinition(next, elementName, min, max, nextDatatype); if (nextElementType.equals(BoundCodeDt.class)) {
IValueSetEnumBinder<Enum<?>> binder = getBoundCodeBinder(next);
def = new RuntimeChildPrimitiveBoundCodeDatatypeDefinition(next, elementName, min, max, nextDatatype, binder);
} else {
def = new RuntimeChildPrimitiveDatatypeDefinition(next, elementName, min, max, nextDatatype);
}
} else { } else {
def = new RuntimeChildCompositeDatatypeDefinition(next, elementName, min, max, nextDatatype); def = new RuntimeChildCompositeDatatypeDefinition(next, elementName, min, max, nextDatatype);
} }
@ -379,13 +390,28 @@ class ModelScanner {
// TODO: handle codes // TODO: handle codes
} else { } else {
throw new ConfigurationException("Field '" + elementName + "' in type '" + theClass.getCanonicalName() + "' is not a valid child type"); throw new ConfigurationException("Field '" + elementName + "' in type '" + theClass.getCanonicalName() + "' is not a valid child type: " + nextElementType);
} }
elementNames.add(elementName); elementNames.add(elementName);
} }
} }
@SuppressWarnings("unchecked")
private IValueSetEnumBinder<Enum<?>> getBoundCodeBinder(Field theNext) {
Class<?> bound = getGenericCollectionTypeOfCodedField(theNext);
if (bound == null) {
throw new ConfigurationException("Field '" + theNext + "' has no parameter for " + BoundCodeDt.class.getSimpleName() + " to determine enum type");
}
try {
Field bindingField = bound.getField("VALUESET_BINDER");
return (IValueSetEnumBinder<Enum<?>>) bindingField.get(null);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
throw new ConfigurationException("Field '" + theNext + "' has type parameter " + bound.getCanonicalName() + " but this class has no valueset binding field", e);
}
}
private Class<?> determineElementType(Field next) { private Class<?> determineElementType(Field next) {
Class<?> nextElementType = next.getType(); Class<?> nextElementType = next.getType();
if (List.class.equals(nextElementType)) { if (List.class.equals(nextElementType)) {
@ -446,7 +472,15 @@ class ModelScanner {
Class<?> type; Class<?> type;
// if (genericSuperclass == null) { // if (genericSuperclass == null) {
ParameterizedType collectionType = (ParameterizedType) next.getGenericType(); ParameterizedType collectionType = (ParameterizedType) next.getGenericType();
type = (Class<?>) collectionType.getActualTypeArguments()[0]; Type firstArg = collectionType.getActualTypeArguments()[0];
if (ParameterizedType.class.isAssignableFrom(firstArg.getClass())) {
ParameterizedType pt = ((ParameterizedType)firstArg);
type = (Class<?>) pt.getRawType();
// firstArg = pt.getActualTypeArguments()[0];
// type = (Class<?>) firstArg;
}else {
type = (Class<?>) firstArg;
}
// }else { // }else {
// Type[] actualTypeArguments = ((ParameterizedType) // Type[] actualTypeArguments = ((ParameterizedType)
// genericSuperclass).getActualTypeArguments(); // genericSuperclass).getActualTypeArguments();
@ -455,4 +489,18 @@ class ModelScanner {
return type; return type;
} }
private static Class<?> getGenericCollectionTypeOfCodedField(Field next) {
Class<?> type;
ParameterizedType collectionType = (ParameterizedType) next.getGenericType();
Type firstArg = collectionType.getActualTypeArguments()[0];
if (ParameterizedType.class.isAssignableFrom(firstArg.getClass())) {
ParameterizedType pt = ((ParameterizedType)firstArg);
firstArg = pt.getActualTypeArguments()[0];
type = (Class<?>) firstArg;
}else {
type = (Class<?>) firstArg;
}
return type;
}
} }

View File

@ -7,8 +7,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IResource;
public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefinition { public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefinition {
@ -46,8 +49,16 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
myDatatypeToElementDefinition =new HashMap<Class<? extends IElement>, BaseRuntimeElementDefinition<?>>(); myDatatypeToElementDefinition =new HashMap<Class<? extends IElement>, BaseRuntimeElementDefinition<?>>();
for (Class<? extends IElement> next : myChoiceTypes) { for (Class<? extends IElement> next : myChoiceTypes) {
BaseRuntimeElementDefinition<?> nextDef = theClassToElementDefinitions.get(next);
String elementName = getElementName() + nextDef.getName(); String elementName;
BaseRuntimeElementDefinition<?> nextDef;
if (IResource.class.isAssignableFrom(next)) {
elementName = getElementName() + StringUtils.capitalize(next.getSimpleName());
nextDef = new RuntimeResourceReferenceDefinition(elementName);
} else {
nextDef = theClassToElementDefinitions.get(next);
elementName = getElementName() + StringUtils.capitalize(nextDef.getName());
}
myNameToChildDefinition.put(elementName, nextDef); myNameToChildDefinition.put(elementName, nextDef);
myDatatypeToElementDefinition.put(next, nextDef); myDatatypeToElementDefinition.put(next, nextDef);

View File

@ -0,0 +1,22 @@
package ca.uhn.fhir.context;
import java.lang.reflect.Field;
import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChildPrimitiveDatatypeDefinition {
private IValueSetEnumBinder<Enum<?>> myBinder;
public RuntimeChildPrimitiveBoundCodeDatatypeDefinition(Field theField, String theElementName, int theMin, int theMax, Class<? extends IDatatype> theDatatype, IValueSetEnumBinder<Enum<?>> theBinder) {
super(theField, theElementName, theMin, theMax, theDatatype);
myBinder = theBinder;
}
public IValueSetEnumBinder<Enum<?>> getInstanceConstructorArguments() {
return myBinder;
}
}

View File

@ -21,4 +21,5 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
return ChildTypeEnum.PRIMITIVE_DATATYPE; return ChildTypeEnum.PRIMITIVE_DATATYPE;
} }
} }

View File

@ -0,0 +1,9 @@
package ca.uhn.fhir.model.api;
public interface IValueSetEnumBinder<T extends Enum<?>> {
T fromCodeString(String theCodeString);
String toCodeString(T theEnum);
}

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.model.api;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
public class ResourceReference implements IElement { public class ResourceReference implements IDatatype {
private String myDisplay; private String myDisplay;
private String myReference; private String myReference;

View File

@ -1,54 +0,0 @@
package ca.uhn.fhir.model.api;
import java.util.HashMap;
import java.util.Map;
public abstract class ValueSetEnumeration {
private static final Map<Class<? extends ValueSetEnumeration>, CodeMap> myClassToCodeMap = new HashMap<Class<? extends ValueSetEnumeration>, ValueSetEnumeration.CodeMap>();
private final String myCode;
private final int myOrdinal;
public ValueSetEnumeration(String theCode, String theValueSetIdentifier) {
myCode = theCode;
CodeMap codeMap = myClassToCodeMap.get(getClass());
if (codeMap == null) {
codeMap = new CodeMap(theValueSetIdentifier);
myClassToCodeMap.put(getClass(), codeMap);
}
myOrdinal = codeMap.nextOrdinal();
codeMap.addCode(this);
}
public String getCode() {
return myCode;
}
public int getOrdinal() {
return myOrdinal;
}
private static class CodeMap {
private Map<String, ValueSetEnumeration> myCodeMap = new HashMap<String, ValueSetEnumeration>();
private int myNextOrdinal = 0;
private String myValueSetIdentifier;
public CodeMap(String theValueSetIdentifier) {
myValueSetIdentifier = theValueSetIdentifier;
}
public void addCode(ValueSetEnumeration theValueSetEnumeration) {
myCodeMap.put(theValueSetEnumeration.getCode(), theValueSetEnumeration);
}
public int nextOrdinal() {
return myNextOrdinal++;
}
}
}

View File

@ -0,0 +1,81 @@
package ca.uhn.fhir.model.api;
import java.util.HashMap;
import java.util.Map;
public abstract class ValueSetRegistry {
// private Map<String, Class<? extends Enum>>
// private static final Map<Class<? extends ValueSetRegistry>, CodeMap> myClassToCodeMap = new HashMap<Class<? extends ValueSetRegistry>, ValueSetRegistry.CodeMap>();
//
// public static final ValueSetRegistry OTHER = new OtherCode();
//
// private final String myCode;
// private final int myOrdinal;
//
// public ValueSetRegistry(String theCode, String theValueSetIdentifier) {
// myCode = theCode;
// myOrdinal = ourNextOrdinal++;
//
// CodeMap codeMap = myClassToCodeMap.get(getClass());
// if (codeMap == null) {
// codeMap = new CodeMap(theValueSetIdentifier);
// myClassToCodeMap.put(getClass(), codeMap);
// }
//
// codeMap.addCode(this);
//
// }
//
// public ValueSetRegistry() {
// // TODO Auto-generated constructor stub
// }
//
// public ValueSetRegistry getCode(Class<? extends ValueSetRegistry> theType, String theCode) {
// CodeMap codeMap = myClassToCodeMap.get(theType);
// if (codeMap == null) {
//
// }
// }
//
// public String getCode() {
// return myCode;
// }
//
// public int getOrdinal() {
// return myOrdinal;
// }
//
// private static final class OtherCode extends ValueSetRegistry {
// private OtherCode() {
// super();
// }
// }
//
// private static final class OtherInstance extends ValueSetRegistry {
// private OtherInstance(String theCode) {
// super();
// myCode = theCode;
// }
// }
//
// private static class CodeMap {
// private Map<String, ValueSetRegistry> myCodeMap = new HashMap<String, ValueSetRegistry>();
// private String myValueSetIdentifier;
// private int myNextOrdinal = 0;
//
// public CodeMap(String theValueSetIdentifier) {
// myValueSetIdentifier = theValueSetIdentifier;
// }
//
// public void addCode(ValueSetRegistry theValueSetEnumeration) {
// myCodeMap.put(theValueSetEnumeration.getCode(), theValueSetEnumeration);
// }
//
// public int nextOrdinal() {
// return myNextOrdinal++;
// }
// }
}

View File

@ -6,6 +6,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(value= {ElementType.FIELD}) @Target(value= {ElementType.FIELD})

View File

@ -0,0 +1,27 @@
package ca.uhn.fhir.model.primitive;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@DatatypeDef(name = "code")
public class BoundCodeDt<T extends Enum<?>> extends CodeDt {
private IValueSetEnumBinder<T> myBinder;
public BoundCodeDt(IValueSetEnumBinder<T> theBinder) {
myBinder = theBinder;
}
public BoundCodeDt(IValueSetEnumBinder<T> theBinder, T theValue) {
myBinder = theBinder;
setValueAsEnum(theValue);
}
public void setValueAsEnum(T theValue) {
setValue(myBinder.toCodeString(theValue));
}
public T getValueAsEnum() {
return myBinder.fromCodeString(getValue());
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.EndElement; import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement; import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent; import javax.xml.stream.events.XMLEvent;
@ -16,6 +15,7 @@ import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition; import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition; import ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition;
import ca.uhn.fhir.context.RuntimeChildPrimitiveBoundCodeDatatypeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition;
import ca.uhn.fhir.context.RuntimeResourceBlockDefinition; import ca.uhn.fhir.context.RuntimeResourceBlockDefinition;
@ -493,7 +493,8 @@ class ParserState<T extends IElement> {
} }
case PRIMITIVE_DATATYPE: { case PRIMITIVE_DATATYPE: {
RuntimePrimitiveDatatypeDefinition primitiveTarget = (RuntimePrimitiveDatatypeDefinition) target; RuntimePrimitiveDatatypeDefinition primitiveTarget = (RuntimePrimitiveDatatypeDefinition) target;
IPrimitiveDatatype<?> newChildInstance = primitiveTarget.newInstance(); IPrimitiveDatatype<?> newChildInstance;
newChildInstance = primitiveTarget.newInstance(child.getInstanceConstructorArguments());
child.getMutator().addValue(myInstance, newChildInstance); child.getMutator().addValue(myInstance, newChildInstance);
PrimitiveState newState = new PrimitiveState(newChildInstance); PrimitiveState newState = new PrimitiveState(newChildInstance);
push(newState); push(newState);

View File

@ -11,13 +11,11 @@
<name value="CGTAPatient" /> <name value="CGTAPatient" />
<element> <element>
<path value="Patient.identifier"/> <path value="Patient.identifier"/>
<!-- <!-- <slicing>
<slicing>
<discriminator value="" /> <discriminator value="" />
<ordered value="true"/> <ordered value="true"/>
<rules value="open"/> <rules value="open"/>
</slicing> </slicing> -->
-->
</element> </element>
</structure> </structure>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry combineaccessrules="false" kind="src" path="/hapi-fhir-base"/>
<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/> <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" path="target/generated/valuesets"/> <classpathentry kind="src" path="target/generated/valuesets"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/> <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
@ -255,6 +256,5 @@
</classpathentry> </classpathentry>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/> <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar"/> <classpathentry kind="var" path="M2_REPO/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/hapi-fhir-base"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -1,304 +0,0 @@
package ca.uhn.fhir.starter;
import static org.apache.commons.lang.StringUtils.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.starter.model.AnyChild;
import ca.uhn.fhir.starter.model.BaseElement;
import ca.uhn.fhir.starter.model.Child;
import ca.uhn.fhir.starter.model.Extension;
import ca.uhn.fhir.starter.model.Resource;
import ca.uhn.fhir.starter.model.ResourceBlock;
import ca.uhn.fhir.starter.model.ResourceBlockCopy;
import ca.uhn.fhir.starter.model.SimpleSetter.Parameter;
import ca.uhn.fhir.starter.util.XMLUtils;
public abstract class BaseParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseParser.class);
private int myColBinding;
private int myColCard;
private int myColDefinition;
private int myColName;
private int myColRequirements;
private int myColShortName;
private int myColType;
private int myColV2Mapping;
private String myDirectory;
private ArrayList<Extension> myExtensions;
private String myOutputFile;
private List<Resource> myResources = new ArrayList<Resource>();
public void parse() throws Exception {
File baseDir = new File(myDirectory);
if (baseDir.exists() == false || baseDir.isDirectory() == false) {
throw new Exception(myDirectory + " does not exist or is not a directory");
}
for (File nextFile : baseDir.listFiles()) {
if (isSpreadsheet(nextFile.getAbsolutePath())) {
ourLog.info("Scanning file: {}", nextFile.getAbsolutePath());
File resourceSpreadsheetFile = nextFile;
if (resourceSpreadsheetFile.exists() == false) {
throw new Exception(resourceSpreadsheetFile.getAbsolutePath() + " does not exist");
}
Document file = XMLUtils.parse(new FileInputStream(resourceSpreadsheetFile), false);
Element dataElementsSheet = (Element) file.getElementsByTagName("Worksheet").item(0);
NodeList tableList = dataElementsSheet.getElementsByTagName("Table");
Element table = (Element) tableList.item(0);
NodeList rows = table.getElementsByTagName("Row");
Element defRow = (Element) rows.item(0);
parseFirstRow(defRow);
Element resourceRow = (Element) rows.item(1);
Resource resource = new Resource();
myResources.add(resource);
parseBasicElements(resourceRow, resource);
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
elements.put(resource.getElementName(), resource);
// Map<String,String> blockFullNameToShortName = new HashMap<String,String>();
for (int i = 2; i < rows.getLength(); i++) {
Element nextRow = (Element) rows.item(i);
String name = cellValue(nextRow, 0);
if (name == null || name.startsWith("!")) {
continue;
}
String type = cellValue(nextRow, myColType);
Child elem;
if (StringUtils.isBlank(type) || type.startsWith("=")) {
elem = new ResourceBlock();
} else if (type.startsWith("@")) {
// type = type.substring(type.lastIndexOf('.')+1);
elem = new ResourceBlockCopy();
} else if (type.equals("*")) {
elem = new AnyChild();
} else {
elem = new Child();
}
parseBasicElements(nextRow, elem);
elements.put(elem.getName(), elem);
BaseElement parent = elements.get(elem.getElementParentName());
if (parent == null) {
throw new Exception("Can't find element " + elem.getElementParentName() + " - Valid values are: " + elements.keySet());
}
parent.addChild(elem);
/*
* Find simple setters
*/
if (elem instanceof Child) {
scanForSimpleSetters(elem);
}
}
}
}
ourLog.info("Parsed {} resources", myResources.size());
}
private void scanForSimpleSetters(Child theElem) {
Class<?> childDt;
if (theElem.getReferenceTypesForMultiple().size() == 1) {
try {
childDt = Class.forName("ca.uhn.fhir.model.primitive." + theElem.getReferenceTypesForMultiple().get(0));
} catch (ClassNotFoundException e) {
return;
}
} else {
return;
}
for (Constructor<?> nextConstructor : childDt.getConstructors()) {
SimpleSetter simpleSetter = nextConstructor.getAnnotation(SimpleSetter.class);
if (simpleSetter == null) {
continue;
}
ca.uhn.fhir.starter.model.SimpleSetter ss = new ca.uhn.fhir.starter.model.SimpleSetter();
ss.setDatatype(childDt.getSimpleName());
ss.setSuffix(simpleSetter.suffix());
theElem.getSimpleSetters().add(ss);
Annotation[][] paramAnn = nextConstructor.getParameterAnnotations();
Class<?>[] paramTypes = nextConstructor.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++) {
Parameter p = new Parameter();
p.setDatatype(paramTypes[0].getSimpleName());
p.setParameter(findAnnotation(childDt, paramAnn[i], SimpleSetter.Parameter.class).name());
ss.getParameters().add(p);
}
}
}
private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations,
Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
for (Annotation next : theAnnotations) {
if (theClass.equals(next.annotationType())) {
return (ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter) next;
}
}
throw new IllegalArgumentException(theBase.getCanonicalName() + " has @" + SimpleSetter.class.getCanonicalName() + " constructor with no/invalid parameter annotation");
}
public void setDirectory(String theDirectory) {
myDirectory = theDirectory;
}
public void setExtensions(ArrayList<Extension> theExts) {
myExtensions = theExts;
}
public void setOutputFile(String theOutputFile) {
myOutputFile = theOutputFile;
}
private void parseFirstRow(Element theDefRow) {
for (int i = 0; i < 20; i++) {
String nextName = cellValue(theDefRow, i);
if (nextName == null) {
continue;
}
nextName = nextName.toLowerCase().trim().replace(".", "");
if ("element".equals(nextName)) {
myColName = i;
} else if ("card".equals(nextName)) {
myColCard = i;
} else if ("type".equals(nextName)) {
myColType = i;
} else if ("binding".equals(nextName)) {
myColBinding = i;
} else if ("short name".equals(nextName)) {
myColShortName = i;
} else if ("definition".equals(nextName)) {
myColDefinition = i;
} else if ("requirements".equals(nextName)) {
myColRequirements = i;
} else if ("v2 mapping".equals(nextName)) {
myColV2Mapping = i;
}
}
}
private void write(Resource theResource) throws IOException {
File f = new File(myOutputFile);
FileWriter w = new FileWriter(f, false);
ourLog.info("Writing file: {}", f.getAbsolutePath());
VelocityContext ctx = new VelocityContext();
ctx.put("className", theResource.getName());
ctx.put("shortName", defaultString(theResource.getShortName()));
ctx.put("definition", defaultString(theResource.getDefinition()));
ctx.put("requirements", defaultString(theResource.getRequirement()));
ctx.put("children", theResource.getChildren());
ctx.put("resourceBlockChildren", theResource.getResourceBlockChildren());
ctx.put("childExtensionTypes", ObjectUtils.defaultIfNull(myExtensions, new ArrayList<Extension>()));
VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp");
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
v.setProperty("runtime.references.strict", Boolean.TRUE);
InputStream templateIs = ResourceParser.class.getResourceAsStream(getTemplate());
InputStreamReader templateReader = new InputStreamReader(templateIs);
v.evaluate(ctx, w, "", templateReader);
w.close();
}
protected abstract String getTemplate();
protected void parseBasicElements(Element theRowXml, BaseElement theTarget) {
String name = cellValue(theRowXml, myColName);
theTarget.setName(name);
theTarget.setElementName(name);
String cardValue = cellValue(theRowXml, myColCard);
if (cardValue != null && cardValue.contains("..")) {
String[] split = cardValue.split("\\.\\.");
theTarget.setCardMin(split[0]);
theTarget.setCardMax(split[1]);
}
String type = cellValue(theRowXml, myColType);
theTarget.setTypeFromString(type);
theTarget.setBinding(cellValue(theRowXml, myColBinding));
theTarget.setShortName(cellValue(theRowXml, myColShortName));
theTarget.setDefinition(cellValue(theRowXml, myColDefinition));
theTarget.setRequirement(cellValue(theRowXml, myColRequirements));
theTarget.setV2Mapping(cellValue(theRowXml, myColV2Mapping));
}
static String cellValue(Node theRowXml, int theCellIndex) {
NodeList cells = ((Element) theRowXml).getElementsByTagName("Cell");
for (int i = 0, currentCell = 0; i < cells.getLength(); i++) {
Element nextCell = (Element) cells.item(i);
String indexVal = nextCell.getAttributeNS("urn:schemas-microsoft-com:office:spreadsheet", "Index");
if (StringUtils.isNotBlank(indexVal)) {
// 1-indexed for some reason...
currentCell = Integer.parseInt(indexVal) - 1;
}
if (currentCell == theCellIndex) {
NodeList dataElems = nextCell.getElementsByTagName("Data");
Element dataElem = (Element) dataElems.item(0);
if (dataElem == null) {
return null;
}
String retVal = dataElem.getTextContent();
return retVal;
}
currentCell++;
}
return null;
}
protected boolean isSpreadsheet(String theFileName) {
return true;
}
}

View File

@ -1,24 +0,0 @@
package ca.uhn.fhir.starter;
import java.io.FileNotFoundException;
import java.io.IOException;
public class TinderMojo {
public static void main(String[] args) throws Exception {
ValueSetParser vsp = new ValueSetParser();
vsp.setDirectory("src/test/resources/vs/");
vsp.parse();
DatatypeParser dtp = new DatatypeParser();
dtp.setDirectory("src/test/resources/dt");
dtp.parse();
ResourceParser rp = new ResourceParser();
rp.setDirectory("src/test/resources/res");
rp.parse();
}
}

View File

@ -0,0 +1,197 @@
package ca.uhn.fhir.tinder;
import static org.apache.commons.lang.StringUtils.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.tinder.model.BaseElement;
import ca.uhn.fhir.tinder.model.Child;
import ca.uhn.fhir.tinder.model.Extension;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.SimpleSetter.Parameter;
public abstract class BaseStructureParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureParser.class);
private String myDirectory;
private ArrayList<Extension> myExtensions;
private List<Resource> myResources = new ArrayList<Resource>();
public void bindValueSets(ValueSetParser theVsp) {
for (Resource next : myResources) {
bindValueSets(next, theVsp);
}
}
public void addResource(Resource theResource) {
myResources.add(theResource);
}
public String getDirectory() {
return myDirectory;
}
private void bindValueSets(BaseElement theResource, ValueSetParser theVsp) {
if (isNotBlank(theResource.getBinding())) {
String bindingClass = theVsp.getClassForValueSetIdAndMarkAsNeeded(theResource.getBinding());
if (bindingClass!= null) {
theResource.setBindingClass(bindingClass);
}
}
for (BaseElement next : theResource.getChildren()) {
bindValueSets(next, theVsp);
}
}
protected void scanForSimpleSetters(Child theElem) {
Class<?> childDt;
if (theElem.getReferenceTypesForMultiple().size() == 1) {
try {
childDt = Class.forName("ca.uhn.fhir.model.primitive." + theElem.getReferenceTypesForMultiple().get(0));
} catch (ClassNotFoundException e) {
return;
}
} else {
return;
}
for (Constructor<?> nextConstructor : childDt.getConstructors()) {
SimpleSetter simpleSetter = nextConstructor.getAnnotation(SimpleSetter.class);
if (simpleSetter == null) {
continue;
}
ca.uhn.fhir.tinder.model.SimpleSetter ss = new ca.uhn.fhir.tinder.model.SimpleSetter();
ss.setDatatype(childDt.getSimpleName());
ss.setSuffix(simpleSetter.suffix());
theElem.getSimpleSetters().add(ss);
Annotation[][] paramAnn = nextConstructor.getParameterAnnotations();
Class<?>[] paramTypes = nextConstructor.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++) {
Parameter p = new Parameter();
p.setDatatype(paramTypes[0].getSimpleName());
p.setParameter(findAnnotation(childDt, paramAnn[i], SimpleSetter.Parameter.class).name());
ss.getParameters().add(p);
}
}
}
public List<Resource> getResources() {
return myResources;
}
private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations, Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
for (Annotation next : theAnnotations) {
if (theClass.equals(next.annotationType())) {
return (ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter) next;
}
}
throw new IllegalArgumentException(theBase.getCanonicalName() + " has @" + SimpleSetter.class.getCanonicalName() + " constructor with no/invalid parameter annotation");
}
public void setDirectory(String theDirectory) {
myDirectory = theDirectory;
}
public void setExtensions(ArrayList<Extension> theExts) {
myExtensions = theExts;
}
public void writeAll(String theOutputDirectory) throws IOException {
File targetDir = new File(theOutputDirectory);
if (!targetDir.exists()) {
targetDir.mkdirs();
}
if (!targetDir.isDirectory()) {
throw new IOException(theOutputDirectory + " is not a directory");
}
for (Resource next : myResources) {
File f = new File(theOutputDirectory, next.getName() + getFilenameSuffix() + ".java");
write(next, f);
}
}
protected abstract String getFilenameSuffix();
private void write(Resource theResource, File theFile) throws IOException {
FileWriter w = new FileWriter(theFile, false);
ourLog.info("Writing file: {}", theFile.getAbsolutePath());
VelocityContext ctx = new VelocityContext();
ctx.put("className", theResource.getName());
ctx.put("shortName", defaultString(theResource.getShortName()));
ctx.put("definition", defaultString(theResource.getDefinition()));
ctx.put("requirements", defaultString(theResource.getRequirement()));
ctx.put("children", theResource.getChildren());
ctx.put("resourceBlockChildren", theResource.getResourceBlockChildren());
ctx.put("childExtensionTypes", ObjectUtils.defaultIfNull(myExtensions, new ArrayList<Extension>()));
VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp");
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
v.setProperty("runtime.references.strict", Boolean.TRUE);
InputStream templateIs = ResourceSpreadsheetParser.class.getResourceAsStream(getTemplate());
InputStreamReader templateReader = new InputStreamReader(templateIs);
v.evaluate(ctx, w, "", templateReader);
w.close();
}
protected abstract String getTemplate();
static String cellValue(Node theRowXml, int theCellIndex) {
NodeList cells = ((Element) theRowXml).getElementsByTagName("Cell");
for (int i = 0, currentCell = 0; i < cells.getLength(); i++) {
Element nextCell = (Element) cells.item(i);
String indexVal = nextCell.getAttributeNS("urn:schemas-microsoft-com:office:spreadsheet", "Index");
if (StringUtils.isNotBlank(indexVal)) {
// 1-indexed for some reason...
currentCell = Integer.parseInt(indexVal) - 1;
}
if (currentCell == theCellIndex) {
NodeList dataElems = nextCell.getElementsByTagName("Data");
Element dataElem = (Element) dataElems.item(0);
if (dataElem == null) {
return null;
}
String retVal = dataElem.getTextContent();
return retVal;
}
currentCell++;
}
return null;
}
protected boolean isSpreadsheet(String theFileName) {
return true;
}
}

View File

@ -0,0 +1,165 @@
package ca.uhn.fhir.tinder;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import ca.uhn.fhir.tinder.model.AnyChild;
import ca.uhn.fhir.tinder.model.BaseElement;
import ca.uhn.fhir.tinder.model.Child;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.ResourceBlock;
import ca.uhn.fhir.tinder.model.ResourceBlockCopy;
import ca.uhn.fhir.tinder.util.XMLUtils;
public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureSpreadsheetParser.class);
private int myColBinding;
private int myColCard;
private int myColDefinition;
private int myColName;
private int myColRequirements;
private int myColShortName;
private int myColType;
private int myColV2Mapping;
public void parse() throws Exception {
File baseDir = new File(getDirectory());
if (baseDir.exists() == false || baseDir.isDirectory() == false) {
throw new Exception(getDirectory() + " does not exist or is not a directory");
}
for (File nextFile : baseDir.listFiles()) {
if (isSpreadsheet(nextFile.getAbsolutePath())) {
ourLog.info("Scanning file: {}", nextFile.getAbsolutePath());
File resourceSpreadsheetFile = nextFile;
if (resourceSpreadsheetFile.exists() == false) {
throw new Exception(resourceSpreadsheetFile.getAbsolutePath() + " does not exist");
}
Document file = XMLUtils.parse(new FileInputStream(resourceSpreadsheetFile), false);
Element dataElementsSheet = (Element) file.getElementsByTagName("Worksheet").item(0);
NodeList tableList = dataElementsSheet.getElementsByTagName("Table");
Element table = (Element) tableList.item(0);
NodeList rows = table.getElementsByTagName("Row");
Element defRow = (Element) rows.item(0);
parseFirstRow(defRow);
Element resourceRow = (Element) rows.item(1);
Resource resource = new Resource();
addResource(resource);
parseBasicElements(resourceRow, resource);
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
elements.put(resource.getElementName(), resource);
// Map<String,String> blockFullNameToShortName = new
// HashMap<String,String>();
for (int i = 2; i < rows.getLength(); i++) {
Element nextRow = (Element) rows.item(i);
String name = cellValue(nextRow, 0);
if (name == null || name.startsWith("!")) {
continue;
}
String type = cellValue(nextRow, myColType);
Child elem;
if (StringUtils.isBlank(type) || type.startsWith("=")) {
elem = new ResourceBlock();
} else if (type.startsWith("@")) {
// type = type.substring(type.lastIndexOf('.')+1);
elem = new ResourceBlockCopy();
} else if (type.equals("*")) {
elem = new AnyChild();
} else {
elem = new Child();
}
parseBasicElements(nextRow, elem);
elements.put(elem.getName(), elem);
BaseElement parent = elements.get(elem.getElementParentName());
if (parent == null) {
throw new Exception("Can't find element " + elem.getElementParentName() + " - Valid values are: " + elements.keySet());
}
parent.addChild(elem);
/*
* Find simple setters
*/
if (elem instanceof Child) {
scanForSimpleSetters(elem);
}
}
}
}
ourLog.info("Parsed {} resources", getResources().size());
}
private void parseFirstRow(Element theDefRow) {
for (int i = 0; i < 20; i++) {
String nextName = cellValue(theDefRow, i);
if (nextName == null) {
continue;
}
nextName = nextName.toLowerCase().trim().replace(".", "");
if ("element".equals(nextName)) {
myColName = i;
} else if ("card".equals(nextName)) {
myColCard = i;
} else if ("type".equals(nextName)) {
myColType = i;
} else if ("binding".equals(nextName)) {
myColBinding = i;
} else if ("short name".equals(nextName)) {
myColShortName = i;
} else if ("definition".equals(nextName)) {
myColDefinition = i;
} else if ("requirements".equals(nextName)) {
myColRequirements = i;
} else if ("v2 mapping".equals(nextName)) {
myColV2Mapping = i;
}
}
}
protected void parseBasicElements(Element theRowXml, BaseElement theTarget) {
String name = cellValue(theRowXml, myColName);
theTarget.setName(name);
theTarget.setElementName(name);
String cardValue = cellValue(theRowXml, myColCard);
if (cardValue != null && cardValue.contains("..")) {
String[] split = cardValue.split("\\.\\.");
theTarget.setCardMin(split[0]);
theTarget.setCardMax(split[1]);
}
String type = cellValue(theRowXml, myColType);
theTarget.setTypeFromString(type);
theTarget.setBinding(cellValue(theRowXml, myColBinding));
theTarget.setShortName(cellValue(theRowXml, myColShortName));
theTarget.setDefinition(cellValue(theRowXml, myColDefinition));
theTarget.setRequirement(cellValue(theRowXml, myColRequirements));
theTarget.setV2Mapping(cellValue(theRowXml, myColV2Mapping));
}
}

View File

@ -1,16 +1,18 @@
package ca.uhn.fhir.starter; package ca.uhn.fhir.tinder;
import org.w3c.dom.Element;
import ca.uhn.fhir.starter.model.BaseElement; public class DatatypeSpreadsheetParser extends BaseStructureSpreadsheetParser {
public class DatatypeParser extends BaseParser {
@Override @Override
protected String getTemplate() { protected String getTemplate() {
return "/dt_composite.vm"; return "/dt_composite.vm";
} }
@Override
protected String getFilenameSuffix() {
return "Dt";
}
// @Override // @Override
// protected void parseBasicElements(Element theRowXml, BaseElement theTarget) { // protected void parseBasicElements(Element theRowXml, BaseElement theTarget) {

View File

@ -0,0 +1,213 @@
package ca.uhn.fhir.tinder;
import static org.apache.commons.lang.StringUtils.*;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xslf.model.geom.AddSubtractExpression;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.dstu.resource.Profile;
import ca.uhn.fhir.model.dstu.resource.Profile.ExtensionDefn;
import ca.uhn.fhir.model.dstu.resource.Profile.Structure;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElement;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElementDefinition;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElementDefinitionType;
import ca.uhn.fhir.model.dstu.valueset.DataTypeEnum;
import ca.uhn.fhir.parser.XmlParser;
import ca.uhn.fhir.tinder.model.AnyChild;
import ca.uhn.fhir.tinder.model.BaseElement;
import ca.uhn.fhir.tinder.model.Child;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.ResourceBlock;
import ca.uhn.fhir.tinder.model.ResourceBlockCopy;
import ca.uhn.fhir.tinder.model.Slicing;
public class ProfileParser extends BaseStructureParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ProfileParser.class);
public static void main(String[] args) throws Exception {
FhirContext fhirContext = new FhirContext(Profile.class);
XmlParser parser = fhirContext.newXmlParser();
String file = IOUtils.toString(new FileReader("src/test/resources/prof/organization.xml"));
Profile text = (Profile) parser.parseResource(file);
ValueSetParser vsp = new ValueSetParser();
vsp.setDirectory("src/test/resources/vs/");
vsp.parse();
ProfileParser p = new ProfileParser();
p.parseSingleProfile(text);
p.bindValueSets(vsp);
p.writeAll("target/generated/valuesets/ca/uhn/fhir/model/dstu/resource");
}
public void parseSingleProfile(Profile theProfile) throws Exception {
for (Structure nextStructure : theProfile.getStructure()) {
int elemIdx = 0;
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
for (StructureElement next : nextStructure.getElement()) {
BaseElement elem;
if (elemIdx == 0) {
Resource resource = new Resource();
addResource(resource);
elem = resource;
// below StringUtils.isBlank(type) || type.startsWith("=")
} else if (next.getDefinition().getType().isEmpty()) {
elem = new ResourceBlock();
// } else if (type.startsWith("@")) {
// elem = new ResourceBlockCopy();
// } else if (type.equals("*")) {
// elem = new AnyChild();
} else {
elem = new Child();
}
elem.setName(next.getPath().getValue());
elem.setElementName(next.getPath().getValue());
boolean allResourceReferences = next.getDefinition().getType().size() > 0;
for (StructureElementDefinitionType nextType : next.getDefinition().getType()) {
if (nextType.getCode().getValueAsEnum() != DataTypeEnum.RESOURCEREFERENCE) {
allResourceReferences = false;
}
}
elem.setResourceRef(allResourceReferences);
StructureElementDefinition definition = next.getDefinition();
BaseElement parentElement = elements.get(elem.getElementParentName());
Slicing childIsSliced = parentElement != null ? parentElement.getChildElementNameToSlicing().get(elem.getName()) : null;
if (next.getSlicing().getDiscriminator().getValue() != null) {
Slicing slicing = new Slicing();
slicing.setDiscriminator(next.getSlicing().getDiscriminator().getValue());
if (parentElement.getChildElementNameToSlicing().get(elem.getName()) != null) {
throw new ConfigurationException("Found multiple slicing definitions for path: " + next.getPath().getValue());
}
parentElement.getChildElementNameToSlicing().put(elem.getName(), slicing);
continue;
}
/*
* Profiles come with a number of standard elements which are
* generally ignored because they are boilerplate, unless the
* definition is somehow changing their behaviour (e.g. through
* slices)
*/
if (next.getPath().getValue().endsWith(".contained")) {
continue;
}
if (next.getPath().getValue().endsWith(".text")) {
continue;
}
if (next.getPath().getValue().endsWith(".extension")) {
if (childIsSliced!=null) {
if (!"url".equals(childIsSliced.getDiscriminator())) {
throw new ConfigurationException("Extensions must be sliced on 'url' discriminator. Found: " + next.getSlicing().getDiscriminator().getValue());
}
if (next.getDefinition().getType().size() != 1 || next.getDefinition().getType().get(0).getCode().getValueAsEnum() != DataTypeEnum.EXTENSION) {
throw new ConfigurationException("Extension slices must have a single type with a code of 'Extension'");
}
String profile = next.getDefinition().getType().get(0).getProfile().getValueAsString();
if (isBlank(profile)) {
throw new ConfigurationException("Extension slice for " + next.getPath().getValue() + " has no profile specified in its type");
}
if (profile.startsWith("#")) {
Profile.ExtensionDefn extension = findExtension(theProfile, profile.substring(1));
if (extension == null) {
throw new ConfigurationException("Unknown local extension reference: " + profile);
}
ourLog.info("Element at path {} is using extension {}", next.getPath(), profile);
definition = extension.getDefinition();
} else {
// TODO: implement this
throw new ConfigurationException("Extensions specified outside of the given profile are not yet supported");
}
} else {
continue;
}
}
if (next.getPath().getValue().endsWith(".modifierExtension")) {
continue;
}
for (StructureElementDefinitionType nextType : definition.getType()) {
if (nextType.getCode().getValueAsEnum() == DataTypeEnum.RESOURCEREFERENCE) {
if (nextType.getProfile().getValueAsString().startsWith("http://hl7.org/fhir/profiles/")) {
elem.getType().add(capitalize(nextType.getProfile().getValueAsString().substring("http://hl7.org/fhir/profiles/".length())));
} else {
// TODO: implement this.. we need to be able to
// reference other profiles
throw new ConfigurationException("Profile type not yet supported");
}
} else {
elem.getType().add(capitalize(nextType.getCode().getValue()) + "Dt");
}
}
elem.setBinding(definition.getBinding().getName().getValue());
elem.setShortName(definition.getShort().getValue());
elem.setDefinition(definition.getFormal().getValue());
elem.setRequirement(definition.getRequirements().getValue());
elem.setCardMin(definition.getMin().getValueAsString());
elem.setCardMax(definition.getMax().getValue());
if (elem instanceof Child) {
Child child = (Child) elem;
elements.put(elem.getName(), elem);
if (parentElement == null) {
throw new Exception("Can't find element " + elem.getElementParentName() + " - Valid values are: " + elements.keySet());
}
parentElement.addChild(child);
/*
* Find simple setters
*/
scanForSimpleSetters(child);
} else {
Resource res = (Resource) elem;
elements.put(res.getName(), res);
}
elemIdx++;
}
}
}
private ExtensionDefn findExtension(Profile theProfile, String theCode) {
for (ExtensionDefn next : theProfile.getExtensionDefn()) {
if (theCode.equals(next.getCode().getValue())) {
return next;
}
}
return null;
}
@Override
protected String getFilenameSuffix() {
return "";
}
@Override
protected String getTemplate() {
return "/resource.vm";
}
}

View File

@ -1,10 +1,8 @@
package ca.uhn.fhir.starter; package ca.uhn.fhir.tinder;
import java.util.ArrayList;
import java.util.List;
public class ResourceParser extends BaseParser {
public class ResourceSpreadsheetParser extends BaseStructureSpreadsheetParser {
@Override @Override
@ -17,8 +15,14 @@ public class ResourceParser extends BaseParser {
return theFileName.endsWith("spreadsheet.xml"); return theFileName.endsWith("spreadsheet.xml");
} }
@Override
protected String getFilenameSuffix() {
return "";
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// ResourceParser p = new ResourceParser(); // ResourceSpreadsheetParser p = new ResourceSpreadsheetParser();
// p.setAllDatatypes(new ArrayList<String>()); // p.setAllDatatypes(new ArrayList<String>());
// p.setDirectory("src/test/resources/res"); // p.setDirectory("src/test/resources/res");
// //
@ -93,7 +97,7 @@ public class ResourceParser extends BaseParser {
// p.setOutputFile(basePath + "/ca/uhn/fhir/model/dstu/resource/Practitioner.java"); // p.setOutputFile(basePath + "/ca/uhn/fhir/model/dstu/resource/Practitioner.java");
// p.parse(); // p.parse();
// //
// DatatypeParser d = new DatatypeParser(); // DatatypeSpreadsheetParser d = new DatatypeSpreadsheetParser();
// d.setDirectory("src/test/resources/dt"); // d.setDirectory("src/test/resources/dt");
// d.setDatatypeName("humanname"); // d.setDatatypeName("humanname");
// d.setOutputFile(basePath + "/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java"); // d.setOutputFile(basePath + "/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java");

View File

@ -0,0 +1,32 @@
package ca.uhn.fhir.tinder;
public class TinderMojo {
public static void main(String[] args) throws Exception {
ValueSetParser vsp = new ValueSetParser();
vsp.setDirectory("src/test/resources/vs/");
vsp.parse();
DatatypeSpreadsheetParser dtp = new DatatypeSpreadsheetParser();
dtp.setDirectory("src/test/resources/dt");
dtp.parse();
dtp.bindValueSets(vsp);
String dtOutputDir = "target/generated/valuesets/ca/uhn/fhir/model/dstu/composite";
dtp.writeAll(dtOutputDir);
ResourceSpreadsheetParser rp = new ResourceSpreadsheetParser();
rp.setDirectory("src/test/resources/res");
rp.parse();
rp.bindValueSets(vsp);
String rpOutputDir = "target/generated/valuesets/ca/uhn/fhir/model/dstu/resource";
rp.writeAll(rpOutputDir);
String vsOutputDir = "target/generated/valuesets/ca/uhn/fhir/model/dstu/valueset";
vsp.writeMarkedValueSets(vsOutputDir);
}
}

View File

@ -1,6 +1,4 @@
package ca.uhn.fhir.starter; package ca.uhn.fhir.tinder;
import static org.apache.commons.lang.StringUtils.*;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -9,8 +7,11 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.Collection;
import java.util.List; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -23,24 +24,26 @@ import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.dstu.resource.ValueSet; import ca.uhn.fhir.model.dstu.resource.ValueSet;
import ca.uhn.fhir.model.dstu.resource.ValueSet.DefineConcept; import ca.uhn.fhir.model.dstu.resource.ValueSet.DefineConcept;
import ca.uhn.fhir.starter.model.ValueSetTm; import ca.uhn.fhir.tinder.model.ValueSetTm;
import ca.uhn.fhir.starter.model.ValueSetTm.Code; import ca.uhn.fhir.tinder.model.ValueSetTm.Code;
public class ValueSetParser { public class ValueSetParser {
private String myDirectory;
private String myValueSetName;
private String myOutputDirectory;
public static void main(String[] args) throws FileNotFoundException, IOException {
// p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
// p.setOutputDirectory("target/generated/valuesets/ca/uhn/fhir/model/dstu/valueset");
// p.parse();
}
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValueSetParser.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValueSetParser.class);
private String myDirectory;
private Set<ValueSetTm> myMarkedValueSets = new HashSet<ValueSetTm>();
private Map<String, ValueSetTm> myValueSets = new HashMap<String, ValueSetTm>();
public String getClassForValueSetIdAndMarkAsNeeded(String theId) {
ValueSetTm vs = myValueSets.get(theId);
if (vs == null) {
return null;
} else {
myMarkedValueSets.add(vs);
return vs.getClassName();
}
}
public void parse() throws FileNotFoundException, IOException { public void parse() throws FileNotFoundException, IOException {
String string = IOUtils.toString(new FileReader(myDirectory + "valuesets.xml")); String string = IOUtils.toString(new FileReader(myDirectory + "valuesets.xml"));
@ -48,7 +51,6 @@ public class ValueSetParser {
int vsCount = 0; int vsCount = 0;
int conceptCount = 0; int conceptCount = 0;
List<ca.uhn.fhir.starter.model.ValueSetTm> valueSets = new ArrayList<ValueSetTm>();
for (BundleEntry next : bundle.getEntries()) { for (BundleEntry next : bundle.getEntries()) {
ValueSet nextVs = (ValueSet) next.getResource(); ValueSet nextVs = (ValueSet) next.getResource();
conceptCount += nextVs.getDefine().getConcept().size(); conceptCount += nextVs.getDefine().getConcept().size();
@ -57,7 +59,6 @@ public class ValueSetParser {
// next.getDisplay().getValue(), next.getDefinition()); // next.getDisplay().getValue(), next.getDefinition());
ValueSetTm vs = new ValueSetTm(); ValueSetTm vs = new ValueSetTm();
valueSets.add(vs);
vs.setName(nextVs.getName().getValue()); vs.setName(nextVs.getName().getValue());
vs.setDescription(nextVs.getDescription().getValue()); vs.setDescription(nextVs.getDescription().getValue());
@ -72,47 +73,29 @@ public class ValueSetParser {
vs.getCodes().add(new Code(nextCodeValue, nextCodeDisplay, nextCodeDefinition)); vs.getCodes().add(new Code(nextCodeValue, nextCodeDisplay, nextCodeDefinition));
} }
// if (vsCount > 5) { if (myValueSets.containsKey(vs.getName())) {
// break; ourLog.warn("Duplicate Name: " + vs.getName());
// } continue;
}
myValueSets.put(vs.getName(), vs);
// if (vsCount > 5) {
// break;
// }
} }
} }
public void write(List<ValueSetTm> theValueSets) throws IOException { public void setDirectory(String theString) {
myDirectory = theString;
}
public void write(Collection<ValueSetTm> theValueSets, String theOutputDirectory) throws IOException {
for (ValueSetTm nextValueSetTm : theValueSets) { for (ValueSetTm nextValueSetTm : theValueSets) {
write(nextValueSetTm); write(nextValueSetTm, theOutputDirectory);
} }
} }
private void write(ValueSetTm theValueSetTm) throws IOException {
File targetDir = new File(myOutputDirectory);
if (!targetDir.exists()) {
targetDir.mkdirs();
}
if (!targetDir.isDirectory()) {
throw new IOException(myOutputDirectory + " is not a directory");
}
File f = new File(myOutputDirectory, theValueSetTm.getClassName() + ".java");
FileWriter w = new FileWriter(f, false);
ourLog.info("Writing file: {}", f.getAbsolutePath());
VelocityContext ctx = new VelocityContext();
ctx.put("valueSet", theValueSetTm);
VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp");
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
v.setProperty("runtime.references.strict", Boolean.TRUE);
InputStream templateIs = ResourceParser.class.getResourceAsStream("/valueset.vm");
InputStreamReader templateReader = new InputStreamReader(templateIs);
v.evaluate(ctx, w, "", templateReader);
w.close();
}
private String toClassName(String theValue) { private String toClassName(String theValue) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
@ -133,19 +116,54 @@ public class ValueSetParser {
} }
b.append(next); b.append(next);
} }
return b.toString();
}
private void setOutputDirectory(String theString) { b.append("Enum");
myOutputDirectory = theString; return b.toString();
} }
// private void setValueSetName(String theString) { // private void setValueSetName(String theString) {
// myValueSetName = theString; // myValueSetName = theString;
// } // }
public void setDirectory(String theString) { private void write(ValueSetTm theValueSetTm, String theOutputDirectory) throws IOException {
myDirectory = theString; File targetDir = new File(theOutputDirectory);
if (!targetDir.exists()) {
targetDir.mkdirs();
}
if (!targetDir.isDirectory()) {
throw new IOException(theOutputDirectory + " is not a directory");
}
File f = new File(theOutputDirectory, theValueSetTm.getClassName() + ".java");
FileWriter w = new FileWriter(f, false);
ourLog.info("Writing file: {}", f.getAbsolutePath());
VelocityContext ctx = new VelocityContext();
ctx.put("valueSet", theValueSetTm);
VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp");
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
v.setProperty("runtime.references.strict", Boolean.TRUE);
InputStream templateIs = ResourceSpreadsheetParser.class.getResourceAsStream("/valueset.vm");
InputStreamReader templateReader = new InputStreamReader(templateIs);
v.evaluate(ctx, w, "", templateReader);
w.close();
}
public static void main(String[] args) throws FileNotFoundException, IOException {
// p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
// p.setOutputDirectory("target/generated/valuesets/ca/uhn/fhir/model/dstu/valueset");
// p.parse();
}
public void writeMarkedValueSets(String theOutputDirectory) throws IOException {
write(myMarkedValueSets, theOutputDirectory);
} }
} }

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
public class AnyChild extends Child { public class AnyChild extends Child {

View File

@ -1,17 +1,21 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import static org.apache.commons.lang.StringUtils.*; import static org.apache.commons.lang.StringUtils.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
public abstract class BaseElement { public abstract class BaseElement {
private String myBinding; private String myBinding;
private String myBindingClass;
private String myCardMax; private String myCardMax;
private String myCardMin; private String myCardMin;
private Map<String, Slicing> myChildElementNameToSlicing = new HashMap<String, Slicing>();
private List<BaseElement> myChildren; private List<BaseElement> myChildren;
private String myComments; private String myComments;
private String myDefinition; private String myDefinition;
@ -24,10 +28,21 @@ public abstract class BaseElement {
private List<String> myType; private List<String> myType;
private String myV2Mapping; private String myV2Mapping;
public void addChild(Child theElem) {
if (myChildren == null) {
myChildren = new ArrayList<BaseElement>();
}
myChildren.add(theElem);
}
public String getBinding() { public String getBinding() {
return myBinding; return myBinding;
} }
public String getBindingClass() {
return myBindingClass;
}
public String getCardMax() { public String getCardMax() {
return myCardMax; return myCardMax;
} }
@ -36,6 +51,10 @@ public abstract class BaseElement {
return myCardMin; return myCardMin;
} }
public Map<String, Slicing> getChildElementNameToSlicing() {
return myChildElementNameToSlicing;
}
public List<BaseElement> getChildren() { public List<BaseElement> getChildren() {
if (myChildren == null) { if (myChildren == null) {
myChildren = new ArrayList<BaseElement>(); myChildren = new ArrayList<BaseElement>();
@ -43,8 +62,6 @@ public abstract class BaseElement {
return myChildren; return myChildren;
} }
public String getComments() { public String getComments() {
return myComments; return myComments;
} }
@ -90,6 +107,8 @@ public abstract class BaseElement {
return myType; return myType;
} }
public abstract String getTypeSuffix();
public String getV2Mapping() { public String getV2Mapping() {
return myV2Mapping; return myV2Mapping;
} }
@ -106,6 +125,10 @@ public abstract class BaseElement {
myBinding = theCellValue; myBinding = theCellValue;
} }
public void setBindingClass(String theBindingClass) {
myBindingClass = theBindingClass;
}
public void setCardMax(String theCardMax) { public void setCardMax(String theCardMax) {
myCardMax = theCardMax; myCardMax = theCardMax;
} }
@ -114,6 +137,10 @@ public abstract class BaseElement {
myCardMin = theCardMin; myCardMin = theCardMin;
} }
public void setChildElementNameToSlicing(Map<String, Slicing> theChildElementNameToSlicing) {
myChildElementNameToSlicing = theChildElementNameToSlicing;
}
public void setComments(String theComments) { public void setComments(String theComments) {
myComments = theComments; myComments = theComments;
} }
@ -125,19 +152,15 @@ public abstract class BaseElement {
public void setElementName(String theName) { public void setElementName(String theName) {
int lastDot = theName.lastIndexOf('.'); int lastDot = theName.lastIndexOf('.');
if (lastDot == -1) { if (lastDot == -1) {
myElementName= (theName); myElementName = (theName);
} else { } else {
String elementName = theName.substring(lastDot + 1); String elementName = theName.substring(lastDot + 1);
String elementParentName = theName.substring(0, lastDot); String elementParentName = theName.substring(0, lastDot);
myElementName=(elementName); myElementName = (elementName);
myElementParentName=(elementParentName); myElementParentName = (elementParentName);
} }
} }
public void setElementParentName(String theElementParentName) {
myElementParentName = theElementParentName;
}
public void setName(String theName) { public void setName(String theName) {
myName = theName; myName = theName;
} }
@ -146,6 +169,10 @@ public abstract class BaseElement {
myRequirement = theString; myRequirement = theString;
} }
public void setResourceRef(boolean theResourceRef) {
myResourceRef = theResourceRef;
}
public void setShortName(String theShortName) { public void setShortName(String theShortName) {
myShortName = theShortName; myShortName = theShortName;
} }
@ -159,7 +186,7 @@ public abstract class BaseElement {
if (typeString.toLowerCase().startsWith("resource(")) { if (typeString.toLowerCase().startsWith("resource(")) {
typeString = typeString.substring("Resource(".length(), typeString.length() - 1); typeString = typeString.substring("Resource(".length(), typeString.length() - 1);
myResourceRef = true; myResourceRef = true;
}else if (typeString.startsWith("@")) { } else if (typeString.startsWith("@")) {
typeString = typeString.substring(1); typeString = typeString.substring(1);
typeString = ResourceBlock.convertFhirPathNameToClassName(typeString); typeString = ResourceBlock.convertFhirPathNameToClassName(typeString);
} else if (typeString.equals("*")) { } else if (typeString.equals("*")) {
@ -186,17 +213,8 @@ public abstract class BaseElement {
} }
public abstract String getTypeSuffix();
public void setV2Mapping(String theV2Mapping) { public void setV2Mapping(String theV2Mapping) {
myV2Mapping = theV2Mapping; myV2Mapping = theV2Mapping;
} }
public void addChild(Child theElem) {
if(myChildren==null) {
myChildren=new ArrayList<BaseElement>();
}
myChildren.add(theElem);
}
} }

View File

@ -1,8 +1,10 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.ResourceReference; import ca.uhn.fhir.model.api.ResourceReference;
@ -43,12 +45,26 @@ public class Child extends BaseElement {
return elementName; return elementName;
} }
public boolean isBoundCode() {
String singleType = getSingleType();
if ("CodeDt".equals(singleType)) {
if (StringUtils.isNotBlank(getBindingClass())) {
return true;
}
}
return false;
}
public String getReferenceType() { public String getReferenceType() {
String retVal; String retVal;
if (this.isResourceRef()) { if (this.isResourceRef()) {
retVal = (ResourceReference.class.getSimpleName()); retVal = (ResourceReference.class.getSimpleName());
} else if (this.getType().size() == 1 || this instanceof ResourceBlock) { } else if (this.getType().size() == 1 || this instanceof ResourceBlock) {
retVal = getSingleType(); if (isBoundCode()) {
retVal = "BoundCodeDt<" + getBindingClass() + ">";
}else {
retVal = getSingleType();
}
} else { } else {
if (this instanceof Extension && ((Extension) this).getChildExtensions().size() > 0) { if (this instanceof Extension && ((Extension) this).getChildExtensions().size() > 0) {
retVal = ((Extension) this).getNameType(); retVal = ((Extension) this).getNameType();

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
public class Resource extends BaseElement { public class Resource extends BaseElement {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
public class ResourceBlockCopy extends Child { public class ResourceBlockCopy extends Child {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,15 @@
package ca.uhn.fhir.tinder.model;
public class Slicing {
private String myDiscriminator;
public String getDiscriminator() {
return myDiscriminator;
}
public void setDiscriminator(String theDiscriminator) {
myDiscriminator = theDiscriminator;
}
}

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.starter.model; package ca.uhn.fhir.tinder.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -17,6 +17,23 @@ public class ValueSetTm {
myCodes.add(new Code(theCode, theText, theDefinition)); myCodes.add(new Code(theCode, theText, theDefinition));
} }
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ValueSetTm other = (ValueSetTm) obj;
if (myId == null) {
if (other.myId != null)
return false;
} else if (!myId.equals(other.myId))
return false;
return true;
}
public String getClassName() { public String getClassName() {
return myClassName; return myClassName;
} }
@ -37,6 +54,14 @@ public class ValueSetTm {
return StringUtils.defaultString(myName); return StringUtils.defaultString(myName);
} }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((myId == null) ? 0 : myId.hashCode());
return result;
}
public void setClassName(String theClassName) { public void setClassName(String theClassName) {
myClassName = theClassName; myClassName = theClassName;
} }
@ -57,8 +82,7 @@ public class ValueSetTm {
myName = theName; myName = theName;
} }
public static class Code public static class Code {
{
private String myCode; private String myCode;
private String myDefinition; private String myDefinition;

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.starter.util; package ca.uhn.fhir.tinder.util;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringWriter; import java.io.StringWriter;

View File

@ -6,6 +6,7 @@ import java.util.*;
import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*; import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.model.primitive.*; import ca.uhn.fhir.model.primitive.*;
import ca.uhn.fhir.model.dstu.valueset.*;
/** /**
* HAPI/FHIR <b>${className}</b> Datatype * HAPI/FHIR <b>${className}</b> Datatype

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*; import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.model.primitive.*; import ca.uhn.fhir.model.primitive.*;
import ca.uhn.fhir.model.dstu.composite.*; import ca.uhn.fhir.model.dstu.composite.*;
import ca.uhn.fhir.model.dstu.valueset.*;
/** /**
* HAPI/FHIR <b>${className}</b> Resource * HAPI/FHIR <b>${className}</b> Resource
@ -23,7 +24,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
* </p> * </p>
*/ */
@ResourceDef(name="${className}") @ResourceDef(name="${className}")
public class ${className} extends BaseElement implements IResource { public class ${className} extends BaseResource implements IResource {
#childExtensionFields( $childExtensionTypes ) #childExtensionFields( $childExtensionTypes )
#childVars( $children ) #childVars( $children )

View File

@ -47,7 +47,11 @@
public ${child.referenceType} get${child.methodName}() { public ${child.referenceType} get${child.methodName}() {
#if ( ${child.hasMultipleTypes} == false && ${child.singleChildInstantiable} == true ) #if ( ${child.hasMultipleTypes} == false && ${child.singleChildInstantiable} == true )
if (${child.variableName} == null) { if (${child.variableName} == null) {
#if ( ${child.boundCode} && ${child.repeatable} == false )
${child.variableName} = new ${child.referenceTypeForConstructor}(${child.bindingClass}.VALUESET_BINDER);
#else
${child.variableName} = new ${child.referenceTypeForConstructor}(); ${child.variableName} = new ${child.referenceTypeForConstructor}();
#end
} }
#end #end
return ${child.variableName}; return ${child.variableName};
@ -65,6 +69,46 @@
${child.variableName} = theValue; ${child.variableName} = theValue;
} }
#if ( ${child.boundCode} && ${child.repeatable} )
/**
* Add a value for <b>${child.elementName}</b> (${child.shortName})
*
* <p>
* <b>Definition:</b>
* ${child.definition}
* </p>
*/
public void add${child.methodName}(${child.bindingClass} theValue) {
get${child.methodName}().add(new BoundCodeDt<${child.bindingClass}>(${child.bindingClass}.VALUESET_BINDER, theValue));
}
/**
* Sets the value(s), and clears any existing value(s) for <b>${child.elementName}</b> (${child.shortName})
*
* <p>
* <b>Definition:</b>
* ${child.definition}
* </p>
*/
public void set${child.methodName}(${child.bindingClass} theValue) {
get${child.methodName}().clear();
add${child.methodName}(theValue);
}
#elseif ( ${child.boundCode} )
/**
* Sets the value(s) for <b>${child.elementName}</b> (${child.shortName})
*
* <p>
* <b>Definition:</b>
* ${child.definition}
* </p>
*/
public void set${child.methodName}(${child.bindingClass} theValue) {
get${child.methodName}().setValueAsEnum(theValue);
}
#end ##if (child.boundCode)
#foreach ( $ss in $child.simpleSetters ) #foreach ( $ss in $child.simpleSetters )
/** /**
* Sets the value(s) for <b>${child.elementName}</b> (${child.shortName}) * Sets the value(s) for <b>${child.elementName}</b> (${child.shortName})

View File

@ -2,21 +2,10 @@
package ca.uhn.fhir.model.dstu.valueset; package ca.uhn.fhir.model.dstu.valueset;
import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.api.*;
import java.util.HashMap;
import java.util.Map;
public class ${valueSet.className} extends ValueSetEnumeration { public enum ${valueSet.className} {
/**
* Identifier for this Value Set:
* ${valueSet.id}
*/
public static final String VALUESET_IDENTIFIER = "${valueSet.id}";
/**
* Constructor - should not be called directly
*/
protected ${valueSet.className}(String theCode) {
super(theCode, VALUESET_IDENTIFIER);
}
#foreach ($code in $valueSet.codes) #foreach ($code in $valueSet.codes)
/** /**
@ -25,8 +14,68 @@ public class ${valueSet.className} extends ValueSetEnumeration {
* *
* ${code.definition} * ${code.definition}
*/ */
public static final ${valueSet.className} ${code.codeEnumValue} = new ${valueSet.className}("${code.code}"); ${code.codeEnumValue}("${code.code}"),
#end #end
;
/**
* Identifier for this Value Set:
* ${valueSet.id}
*/
public static final String VALUESET_IDENTIFIER = "${valueSet.id}";
/**
* Name for this Value Set:
* ${valueSet.name}
*/
public static final String VALUESET_NAME = "${valueSet.name}";
private static Map<String, ${valueSet.className}> CODE_TO_ENUM = new HashMap<String, ${valueSet.className}>();
private String myCode;
static {
for (${valueSet.className} next : ${valueSet.className}.values()) {
CODE_TO_ENUM.put(next.getCode(), next);
}
}
/**
* Returns the code associated with this enumerated value
*/
public String getCode() {
return myCode;
}
/**
* Returns the enumerated value associated with this code
*/
public ${valueSet.className} forCode(String theCode) {
${valueSet.className} retVal = CODE_TO_ENUM.get(theCode);
return retVal;
}
/**
* Converts codes to their respective enumerated values
*/
public static final IValueSetEnumBinder<${valueSet.className}> VALUESET_BINDER = new IValueSetEnumBinder<${valueSet.className}>() {
@Override
public String toCodeString(${valueSet.className} theEnum) {
return theEnum.getCode();
}
@Override
public ${valueSet.className} fromCodeString(String theCodeString) {
return CODE_TO_ENUM.get(theCodeString);
}
};
/**
* Constructor
*/
${valueSet.className}(String theCode) {
myCode = theCode;
}
} }

View File

@ -0,0 +1,415 @@
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Grahame</Author>
<LastAuthor>Grahame</LastAuthor>
<Created>2012-03-19T11:22:02Z</Created>
<LastSaved>2014-01-15T11:58:34Z</LastSaved>
<Version>14.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>7815</WindowHeight>
<WindowWidth>24375</WindowWidth>
<WindowTopX>2805</WindowTopX>
<WindowTopY>3975</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62" ss:Name="Normal 2">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:ShrinkToFit="1"
ss:WrapText="1"/>
</Style>
<Style ss:ID="s64">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:ShrinkToFit="1"
ss:WrapText="1"/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
<Style ss:ID="s65">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:ShrinkToFit="1"
ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
<Interior ss:Color="#EEECE1" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s66">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:ShrinkToFit="1"
ss:WrapText="1"/>
<Interior ss:Color="#D9D9D9" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s68">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:ShrinkToFit="1"
ss:WrapText="1"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s69">
<Alignment ss:Vertical="Bottom" ss:ShrinkToFit="1" ss:WrapText="1"/>
</Style>
<Style ss:ID="s70">
<Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
</Style>
<Style ss:ID="s72" ss:Parent="s62">
<Alignment ss:Vertical="Top" ss:WrapText="1"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s73" ss:Parent="s62">
<Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="Data Elements">
<Table ss:ExpandedColumnCount="17" ss:ExpandedRowCount="8" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s63" ss:DefaultRowHeight="15">
<Column ss:StyleID="s64" ss:AutoFitWidth="0" ss:Width="92.25"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="36.75"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="30"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="35.25"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="56.25"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="45"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="150.75"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="213.75"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="108.75"/>
<Column ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="161.25" ss:Span="1"/>
<Column ss:Index="12" ss:StyleID="s63" ss:AutoFitWidth="0" ss:Width="135"
ss:Span="2"/>
<Row ss:AutoFitHeight="0" ss:Height="30" ss:StyleID="s65">
<Cell><Data ss:Type="String">Element</Data></Cell>
<Cell><Data ss:Type="String">Card.</Data></Cell>
<Cell><Data ss:Type="String">Inv.</Data></Cell>
<Cell><Data ss:Type="String">Is Modifier</Data></Cell>
<Cell><Data ss:Type="String">Type</Data></Cell>
<Cell><Data ss:Type="String">Binding</Data></Cell>
<Cell><Data ss:Type="String">Short Name</Data></Cell>
<Cell><Data ss:Type="String">Definition</Data></Cell>
<Cell><Data ss:Type="String">Example</Data></Cell>
<Cell><Data ss:Type="String">Requirements</Data></Cell>
<Cell><Data ss:Type="String">Comments</Data></Cell>
<Cell><Data ss:Type="String">RIM Mapping</Data></Cell>
<Cell><Data ss:Type="String">v2 Mapping</Data></Cell>
<Cell><Data ss:Type="String">ServD Mapping</Data></Cell>
<Cell><Data ss:Type="String">To Do</Data></Cell>
<Cell><Data ss:Type="String">Committee Notes</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="60">
<Cell><Data ss:Type="String">Identifier</Data></Cell>
<Cell ss:StyleID="s66"/>
<Cell ss:StyleID="s66"/>
<Cell ss:StyleID="s66"/>
<Cell><Data ss:Type="String">Type</Data></Cell>
<Cell ss:Index="7"><Data ss:Type="String">An identifier intended for computation</Data></Cell>
<Cell><Data ss:Type="String">A technical identifier - identifies some entity uniquely and unambiguously</Data></Cell>
<Cell ss:Index="10"><Data ss:Type="String">Need to be able to identify things with confidence and be sure that the identification is not subject to misinterpretation</Data></Cell>
<Cell ss:Index="12"><Data ss:Type="String">II - see see identifier pattern at http://wiki.hl7.org/index.php?title=Common_Design_Patterns#Identifier_Pattern for relevant discussion. The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs</Data></Cell>
<Cell><Data ss:Type="String">CX / EI (occasionally, more often EI maps to a resource id or a URL)</Data></Cell>
<Cell><Data ss:Type="String">Identifier</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="60">
<Cell><Data ss:Type="String">Identifier.use</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Y</Data></Cell>
<Cell><Data ss:Type="String">code</Data></Cell>
<Cell><Data ss:Type="String">IdentifierUse</Data></Cell>
<Cell><Data ss:Type="String">usual | official | temp | secondary (If known)&#10;</Data></Cell>
<Cell><Data ss:Type="String">The purpose of this identifier</Data></Cell>
<Cell ss:Index="10"><Data ss:Type="String">Allows the appropriate identifier for a particular context of use to be selected from among a set of identifiers</Data></Cell>
<Cell><Data ss:Type="String">This is labeled as &quot;Is Modifier&quot; because applications should not mistake a temporary id for a permanent one. Applications can assume that an identifier is permanent unless it explicitly says that it is temporary</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">N/A - this is sometimes implied by context</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">CX.5</Data></Cell>
<Cell ss:StyleID="s68"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="60">
<Cell><Data ss:Type="String">Identifier.label</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">string</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Description of identifier</Data></Cell>
<Cell><Data ss:Type="String">A text string for the identifier that can be displayed to a human so they can recognize the identifier</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Allows humans to make use of identifiers when the identifier system is not known</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="s68"><Data ss:Type="String">N/A - this is sometimes implied by context</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">N/A</Data></Cell>
<Cell ss:StyleID="s68"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="75">
<Cell><Data ss:Type="String">Identifier.system</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:Index="5"><Data ss:Type="String">uri</Data></Cell>
<Cell ss:Index="7"><Data ss:Type="String">The namespace for the identifier</Data></Cell>
<Cell><Data ss:Type="String">Establishes the namespace in which set of possible id values is unique.</Data></Cell>
<Cell ss:StyleID="Default"><Data ss:Type="String">http://www.acme.com/identifiers/patient or urn:ietf:rfc:3986 if the id itself is a full uri</Data></Cell>
<Cell><Data ss:Type="String">There are many sequences of identifiers. To perform matching, we need to know what sequence we're dealing with. The system identifies a particular sequence or set of unique identifiers</Data></Cell>
<Cell ss:Index="12"><Data ss:Type="String">II.root</Data></Cell>
<Cell><Data ss:Type="String">CX.4 / EI-2-4</Data></Cell>
<Cell><Data ss:Type="String">./IdentifierType</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="60">
<Cell><Data ss:Type="String">Identifier.value</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:Index="5"><Data ss:Type="String">string</Data></Cell>
<Cell ss:Index="7"><Data ss:Type="String">The value that is unique</Data></Cell>
<Cell><Data ss:Type="String">The portion of the identifier typically displayed to the user and which is unique within the context of the system.</Data></Cell>
<Cell><Data ss:Type="Number">123456</Data></Cell>
<Cell ss:Index="11"><Data ss:Type="String">If the value is a full URI, then the system SHALL be urn:ietf:rfc:3986</Data></Cell>
<Cell><Data ss:Type="String">II.extension or II.root if system indicates OID or GUID</Data></Cell>
<Cell><Data ss:Type="String">CX.1 / EI.1</Data></Cell>
<Cell><Data ss:Type="String">./Value</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="String">Identifier.period</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Period</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Time period when id is/was valid for use</Data></Cell>
<Cell><Data ss:Type="String">Time period during which identifier is/was valid for use</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="s68"><Data ss:Type="String">N/A - this is sometimes implied by context</Data></Cell>
<Cell ss:StyleID="Default"><Data ss:Type="String">CX.7 + CX.8</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">./StartDate and ./EndDate</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="String">Identifier.assigner</Data></Cell>
<Cell><Data ss:Type="String">0..1</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Resource(Organization)</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">Organization that issued id (may be just text)</Data></Cell>
<Cell><Data ss:Type="String">Organization that issued/manages the identifier</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
<Cell><Data ss:Type="String">The reference may be just a text description of the assigner</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">II.assigningAuthorityName but note that this is an improper use by the definition of the field</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">CX.4 / (CX.4,CX.9,CX.10)</Data></Cell>
<Cell ss:StyleID="s68"><Data ss:Type="String">./IdentifierIssuingAuthority</Data></Cell>
<Cell ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Selected/>
<FreezePanes/>
<SplitHorizontal>1</SplitHorizontal>
<TopRowBottomPane>1</TopRowBottomPane>
<SplitVertical>5</SplitVertical>
<LeftColumnRightPane>5</LeftColumnRightPane>
<ActivePane>0</ActivePane>
<Panes>
<Pane>
<Number>3</Number>
</Pane>
<Pane>
<Number>1</Number>
<ActiveCol>4</ActiveCol>
</Pane>
<Pane>
<Number>2</Number>
<ActiveRow>0</ActiveRow>
</Pane>
<Pane>
<Number>0</Number>
<ActiveRow>7</ActiveRow>
<ActiveCol>6</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Invariants">
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="2" x:FullColumns="1"
x:FullRows="1" ss:StyleID="s69" ss:DefaultRowHeight="15">
<Column ss:Index="2" ss:StyleID="s69" ss:AutoFitWidth="0" ss:Width="102"
ss:Span="1"/>
<Column ss:Index="4" ss:StyleID="s69" ss:AutoFitWidth="0" ss:Width="386.25"/>
<Column ss:StyleID="s69" ss:AutoFitWidth="0" ss:Width="75"/>
<Column ss:StyleID="s69" ss:AutoFitWidth="0" ss:Width="347.25"/>
<Column ss:StyleID="s69" ss:AutoFitWidth="0" ss:Width="292.5"/>
<Row ss:AutoFitHeight="0" ss:StyleID="s65">
<Cell><Data ss:Type="String">Id</Data></Cell>
<Cell><Data ss:Type="String">Name</Data></Cell>
<Cell><Data ss:Type="String">Context</Data></Cell>
<Cell><Data ss:Type="String">English</Data></Cell>
<Cell><Data ss:Type="String">only-if-no-dar</Data></Cell>
<Cell><Data ss:Type="String">OCL</Data></Cell>
<Cell><Data ss:Type="String">XPath</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:Index="4" ss:StyleID="Default"/>
<Cell ss:StyleID="Default"/>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>1</ActiveRow>
<RangeSelection>R2:R3</RangeSelection>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Bindings">
<Table ss:ExpandedColumnCount="5" ss:ExpandedRowCount="2" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Column ss:AutoFitWidth="0" ss:Width="86.25"/>
<Column ss:AutoFitWidth="0" ss:Width="220.5"/>
<Column ss:AutoFitWidth="0" ss:Width="57"/>
<Column ss:AutoFitWidth="0" ss:Width="139.5"/>
<Row ss:AutoFitHeight="0" ss:Height="30">
<Cell ss:StyleID="s65"><Data ss:Type="String">Binding Name</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Definition</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Binding</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Reference</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Description</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="15.75">
<Cell ss:StyleID="s70"><Data ss:Type="String">IdentifierUse</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Identifies the purpose for this identifier, if known&#10;</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String">code list</Data></Cell>
<Cell ss:StyleID="s70"><Data ss:Type="String">#identifier-use</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>2</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="identifier-use">
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="5" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Column ss:Index="2" ss:AutoFitWidth="0" ss:Width="64.5"/>
<Column ss:AutoFitWidth="0" ss:Width="485.25"/>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="String">Id</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Code</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Definition</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">Comments</Data></Cell>
<Cell ss:StyleID="s65"/>
<Cell ss:StyleID="s65"/>
<Cell ss:StyleID="s65"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="Number">1</Data></Cell>
<Cell ss:StyleID="s72"><Data ss:Type="String">usual</Data></Cell>
<Cell ss:StyleID="s73"><Data ss:Type="String">the identifier recommended for display and use in real-world interactions</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="Number">2</Data></Cell>
<Cell ss:StyleID="s72"><Data ss:Type="String">official</Data></Cell>
<Cell ss:StyleID="s73"><Data ss:Type="String">the identifier considered to be most trusted for the identification of this item</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="Number">3</Data></Cell>
<Cell ss:StyleID="s72"><Data ss:Type="String">temp</Data></Cell>
<Cell ss:StyleID="s73"><Data ss:Type="String">A temporary identifier</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell><Data ss:Type="Number">4</Data></Cell>
<Cell ss:StyleID="s72"><Data ss:Type="String">secondary</Data></Cell>
<Cell ss:StyleID="s73"><Data ss:Type="String">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</Data></Cell>
<Cell><Data ss:Type="String">Unfortunately, this is a common problem that arises in data exchange, where information is not identified in some formats, but some identification must be assigned in other formats</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>1</ActiveRow>
<ActiveCol>1</ActiveCol>
<RangeSelection>R2C2:R5C2</RangeSelection>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,578 @@
<Profile xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../fhir-single.xsd">
<text>
<status value="generated" />
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</text>
<name value="organization" />
<publisher value="ConnectingGTA" />
<description value="TODO: define" />
<status value="draft" />
<date value="2014-02-03" />
<structure>
<type value="Organization" />
<publish value="true" />
<element>
<path value="Organization" />
<definition>
<short value="A grouping of people or organizations with a common purpose" />
<formal
value="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." />
<min value="1" />
<max value="1" />
<type>
<code value="Resource" />
</type>
<constraint>
<key value="1" />
<name value="AtLeastANameOrId" />
<severity value="error" />
<human value="The organization SHALL at least have a name or an id, and possibly more than one" />
<xpath value="count(f:identifier | f:name) &gt; 0" />
</constraint>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.extension" />
<slicing>
<discriminator value="url" />
<ordered value="false"/>
<rules value="open"/>
</slicing>
</element>
<element>
<path value="Organization.extension" />
<definition>
<short value="Provider ID system pool" />
<formal value="An OID which serves as a namespace (ID root in HL7v3, identifier.system in FHIR) for a provider identifier" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
<profile value="#providerIdPool" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource,
and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable,
there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be
met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated
with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what
allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.text" />
<definition>
<short value="Text summary of the
resource, for human interpretation" />
<formal
value="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to
a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative.
Resource definitions may define what content should be represented in the narrative to ensure clinical safety." />
<comments value="Contained resources do not have narrative. Resources
that are not contained SHOULD have a narrative." />
<synonym value="narrative" />
<synonym value="html" />
<synonym value="xhtml" />
<synonym value="display" />
<min value="0" />
<max value="1" />
<type>
<code value="Narrative" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.contained" />
<definition>
<short value="Contained,
inline Resources" />
<formal
value="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor
can they have their own independent transaction scope." />
<comments
value="This should never be done when the content can be identified properly, as once identification is lost, it
is extremely difficult (and context dependent) to restore it again." />
<synonym value="inline resources" />
<synonym value="anonymous resources" />
<synonym value="contained resources" />
<min value="0" />
<max value="*" />
<type>
<code value="Resource" />
</type>
<isModifier value="false" />
</definition>
</element>
<!-- <element> <path value="Organization.providerIdPool" /> <definition> <short value="Contact for the organization for a certain purpose" /> <formal value="Contact for the organization
for a certain purpose." /> <min value="0" /> <max value="*" /> <isModifier value="false" /> <extension url=""></extension> </definition> </element> -->
<element>
<path value="Organization.identifier" />
<definition>
<short value="Identifies this organization across multiple systems" />
<formal value="Identifier for the organization that is used to identify the organization across multiple disparate systems." />
<min value="0" />
<max value="*" />
<type>
<code value="Identifier" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.name" />
<definition>
<short value="Name used for the organization" />
<formal value="A name associated with the organization." />
<min value="0" />
<max value="1" />
<type>
<code value="string" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".name" />
</mapping>
<mapping>
<identity value="v2" />
<map value="XON.1 Organization Name" />
</mapping>
<mapping>
<identity value="servd" />
<map value=".PreferredName/Name" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.type" />
<definition>
<short value="Kind of organization" />
<formal value="The kind of organization that this is." />
<comments
value="Organizations can be corporations, wards, sections, clinical teams, government departments, etc. Note that code is generally a classifier of the type of organization; in many applications, codes are used to identity a particular organization (say, ward) as opposed to another of the same type - these are identifiers, not codes." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="OrganizationType" />
<isExtensible value="true" />
<conformance value="example" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/organization-type" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value=".code" />
</mapping>
<mapping>
<identity value="v2" />
<map value="No equivalent in v2" />
</mapping>
<mapping>
<identity value="servd" />
<map value="n/a" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.telecom" />
<definition>
<short value="A contact detail for the organization" />
<formal value="A contact detail for the organization." />
<comments
value="The use code home is not to be used. Note that these contacts are not the contact details of people who are employed by or represent the organization, but official contacts for the organization itself." />
<min value="0" />
<max value="*" />
<type>
<code value="Contact" />
</type>
<constraint>
<key value="3" />
<name value="NoHomeUseTelecom" />
<severity value="error" />
<human value="The telecom of an organization can never be of use 'home'" />
<xpath value="count(f:use[@value='home']) = 0" />
</constraint>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".telecom" />
</mapping>
<mapping>
<identity value="v2" />
<map value="No authoritative equivalent in V2.x" />
</mapping>
<mapping>
<identity value="servd" />
<map value="./ContactPoints" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.address" />
<definition>
<short value="An address for the organization" />
<formal value="An address for the organization." />
<comments value="Organization may have multiple addresses with different uses or applicable periods. The use code home is not to be used." />
<min value="0" />
<max value="*" />
<type>
<code value="Address" />
</type>
<constraint>
<key value="2" />
<name value="NoHomeUseAddress" />
<severity value="error" />
<human value="An address of an organization can never be of use 'home'" />
<xpath value="count(f:use[@value='home']) = 0" />
</constraint>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".address" />
</mapping>
<mapping>
<identity value="v2" />
<map value="No authoritative equivalent in V2.x; some V2.x segments such as OBX might provide a serialized instance value" />
</mapping>
<mapping>
<identity value="servd" />
<map value="./PrimaryAddress and ./OtherAddresses" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.partOf" />
<definition>
<short value="The organization of which this organization forms a part" />
<formal value="The organization of which this organization forms a part." />
<min value="0" />
<max value="1" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Organization" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".playedBy[classCode=Part].scoper" />
</mapping>
<mapping>
<identity value="v2" />
<map value="No equivalent in V2.x" />
</mapping>
<mapping>
<identity value="servd" />
<map value="n/a" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact" />
<definition>
<short value="Contact for the organization for a certain purpose" />
<formal value="Contact for the organization for a certain purpose." />
<min value="0" />
<max value="*" />
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".contactParty" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact.extension" />
<definition>
<short value="Additional Content defined by implementations" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.contact.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Organization.contact.purpose" />
<definition>
<short value="The type of contact" />
<formal value="Indicates a purpose for which the contact can be reached." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="ContactPartyType" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/contactentity-type" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="./type" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact.name" />
<definition>
<short value="A name associated with the contact" />
<formal value="A name associated with the contact." />
<min value="0" />
<max value="1" />
<type>
<code value="HumanName" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="./name" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-5, PID-9" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact.telecom" />
<definition>
<short value="Contact details (telephone, email, etc) for a contact" />
<formal value="A contact detail (e.g. a telephone number or an email address) by which the party may be contacted." />
<min value="0" />
<max value="*" />
<type>
<code value="Contact" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="./telecom" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-13, PID-14" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact.address" />
<definition>
<short value="Visiting or postal addresses for the contact" />
<formal value="Visiting or postal addresses for the contact." />
<min value="0" />
<max value="1" />
<type>
<code value="Address" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="./addr" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-11" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.contact.gender" />
<definition>
<short value="Gender for administrative purposes" />
<formal value="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AdministrativeGender" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/administrative-gender" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="./administrativeGender" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-8" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.location" />
<definition>
<short value="Location(s) the organization uses to provide services" />
<formal value="Location(s) the organization uses to provide services." />
<min value="0" />
<max value="*" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Location" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value=".scopedBy[classCode=LocatedEntity].scoper" />
</mapping>
<mapping>
<identity value="servd" />
<map value="./Sites" />
</mapping>
</definition>
</element>
<element>
<path value="Organization.active" />
<definition>
<short value="Whether the organization's record is still in active use" />
<formal value="Whether the organization's record is still in active use." />
<comments value="Default is true." />
<min value="0" />
<max value="1" />
<type>
<code value="boolean" />
</type>
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value=".status" />
</mapping>
<mapping>
<identity value="v2" />
<map value="No equivalent in V2.x" />
</mapping>
<mapping>
<identity value="servd" />
<map
value="./Status (however this concept in ServD more covers why the organization is active or not, could be delisted, deregistered, not operational yet) this could alternatively be derived from ./StartDate and ./EndDate and given a context date." />
</mapping>
</definition>
</element>
<searchParam>
<name value="_id" />
<type value="token" />
<documentation value="The logical resource id associated with the resource (must be supported by all servers)" />
</searchParam>
<searchParam>
<name value="active" />
<type value="token" />
<documentation value="Whether the organization's record is active" />
<xpath value="f:Organization/f:active" />
</searchParam>
<searchParam>
<name value="identifier" />
<type value="token" />
<documentation value="Any identifier for the organization (not the accreditation issuer's identifier)" />
<xpath value="f:Organization/f:identifier" />
</searchParam>
<searchParam>
<name value="name" />
<type value="string" />
<documentation value="A portion of the organization's name" />
<xpath value="f:Organization/f:name" />
</searchParam>
<searchParam>
<name value="partof" />
<type value="reference" />
<documentation value="Search all organizations that are part of the given organization" />
<xpath value="f:Organization/f:partOf" />
</searchParam>
<searchParam>
<name value="phonetic" />
<type value="string" />
<documentation value="A portion of the organization's name using some kind of phonetic matching algorithm" />
</searchParam>
<searchParam>
<name value="type" />
<type value="token" />
<documentation value="A code for the type of organization" />
<xpath value="f:Organization/f:type" />
</searchParam>
</structure>
<extensionDefn>
<code value="providerIdPool" />
<contextType value="resource" />
<context value="Organization" />
<definition>
<short value="Provider ID system pool" />
<formal value="An OID which serves as a namespace (ID root in HL7v3, identifier.system in FHIR) for a provider identifier" />
<min value="0" />
<max value="*" />
<type>
<code value="coding" />
</type>
<mustSupport value="false" />
<isModifier value="false" />
<binding>
<name value="ConnectingGTA Provider ID Namespaces" />
<isExtensible value="false" />
</binding>
</definition>
</extensionDefn>
</Profile>

View File

@ -0,0 +1,988 @@
<Profile xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://hl7.org/fhir ../fhir-single.xsd">
<text>
<status value="generated" />
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</text>
<name value="patient" />
<publisher value="FHIR Project" />
<description value="Basic Profile. Demographics and other administrative information about a person or animal receiving care or other health-related services." />
<status value="draft" />
<date value="2014-02-03" />
<requirements
value="Scope and Usage This Resource covers data about persons and animals involved in a wide range of health-related activities, including: * Curative activities * Psychiatric care * Social services * Pregnancy care * Nursing and assisted living * Dietary services * Tracking of personal health and exercise data The data in the Resource covers the &quot;who&quot; information about the patient: its attributes are focused on the demographic information necessary to support the administrative, financial and logistic procedures. A Patient record is generally created and maintained by each organization providing care for a patient. A person or animal receiving care at multiple organizations may therefore have its information present in multiple Patient Resources." />
<mapping>
<identity value="rim" />
<uri value="http://hl7.org/v3" />
<name value="RIM" />
</mapping>
<mapping>
<identity value="v2" />
<uri value="http://hl7.org/v2" />
<name value="HL7 v2" />
</mapping>
<structure>
<type value="Patient" />
<publish value="true" />
<element>
<path value="Patient" />
<definition>
<short value="Information about a person or animal receiving health care services" />
<formal value="Demographics and other administrative information about a person or animal receiving care or other health-related services." />
<min value="1" />
<max value="1" />
<type>
<code value="Resource" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="Patient[classCode=PAT]" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.extension" />
<definition>
<short value="Additional Content defined by implementations" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.text" />
<definition>
<short value="Text summary of the resource, for human interpretation" />
<formal
value="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." />
<comments value="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative." />
<synonym value="narrative" />
<synonym value="html" />
<synonym value="xhtml" />
<synonym value="display" />
<min value="0" />
<max value="1" />
<type>
<code value="Narrative" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.contained" />
<definition>
<short value="Contained, inline Resources" />
<formal
value="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." />
<comments
value="This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again." />
<synonym value="inline resources" />
<synonym value="anonymous resources" />
<synonym value="contained resources" />
<min value="0" />
<max value="*" />
<type>
<code value="Resource" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.identifier" />
<definition>
<short value="An identifier for the person as this patient" />
<formal value="An identifier that applies to this person as a patient." />
<min value="0" />
<max value="*" />
<type>
<code value="Identifier" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="id" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-3" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.name" />
<definition>
<short value="A name associated with the patient" />
<formal value="A name associated with the individual." />
<comments
value="Person may have multiple names with different uses or applicable periods.For animals, the name is a &quot;HumanName&quot; in the sense that is assigned and used by humans and has the same patterns." />
<min value="0" />
<max value="*" />
<type>
<code value="HumanName" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="name" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-5, PID-9" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.telecom" />
<definition>
<short value="A contact detail for the individual" />
<formal value="A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted." />
<comments
value="Person may have multiple ways to be contacted with different uses or applicable periods. May need to have options for contacting the person urgently and also to help with identification. The address may not go directly to the individual, but may reach another party that is able to proxy for the patient (i.e. home phone, or pet owner's phone)." />
<min value="0" />
<max value="*" />
<type>
<code value="Contact" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="telecom" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-13, PID-14, PID-40" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.gender" />
<definition>
<short value="Gender for administrative purposes" />
<formal value="Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes." />
<comments
value="The gender may not match the biological sex as determined by genetics, or the individual's preferred identification. Note that for both humans and particularly animals, there are other legitimate possibilities than M and F, though the vast majority of systems and contexts only support M and F." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AdministrativeGender" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/administrative-gender" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/administrativeGender" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-8" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.birthDate" />
<definition>
<short value="The date and time of birth for the individual" />
<formal value="The date and time of birth for the individual." />
<comments value="At least an estimated year should be provided as a guess if the real dob is unknown." />
<min value="0" />
<max value="1" />
<type>
<code value="dateTime" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/birthTime" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-7" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.deceased[x]" />
<definition>
<short value="Indicates if the individual is deceased or not" />
<formal value="Indicates if the individual is deceased or not." />
<comments
value="If there's no value in the instance it means there is no statement on whether or not the individual is deceased. Most systems will interpret the absence of a value as a sign of the person being alive." />
<min value="0" />
<max value="1" />
<type>
<code value="boolean" />
</type>
<type>
<code value="dateTime" />
</type>
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/deceasedInd, player[classCode=PSN|ANM and determinerCode=INSTANCE]/deceasedTime" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-30 (bool) and PID-29 (datetime)" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.address" />
<definition>
<short value="Addresses for the individual" />
<formal value="Addresses for the individual." />
<comments value="Person may have multiple addresses with different uses or applicable periods." />
<min value="0" />
<max value="*" />
<type>
<code value="Address" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="addr" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-11" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.maritalStatus" />
<definition>
<short value="Marital (civil) status of a person" />
<formal value="This field contains a patient's most recent marital (civil) status." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="MaritalStatus" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/marital-status" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN]/maritalStatusCode" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-16" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.multipleBirth[x]" />
<definition>
<short value="Whether patient is part of a multiple birth" />
<formal value="Indicates whether the patient is part of a multiple or indicates the actual birth order." />
<min value="0" />
<max value="1" />
<type>
<code value="boolean" />
</type>
<type>
<code value="integer" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/multipleBirthInd, player[classCode=PSN|ANM and determinerCode=INSTANCE]/multipleBirthOrderNumber" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-24 (bool), PID-25 (integer)" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.photo" />
<definition>
<short value="Image of the person" />
<formal value="Image of the person." />
<min value="0" />
<max value="*" />
<type>
<code value="Attachment" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/desc" />
</mapping>
<mapping>
<identity value="v2" />
<map value="OBX-5 - needs a profile" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact" />
<definition>
<short value="A contact party (e.g. guardian, partner, friend) for the patient" />
<formal value="A contact party (e.g. guardian, partner, friend) for the patient." />
<comments
value="Contact covers all kinds of contact parties: family members, business contacts, guardians, caregivers. Not applicable to register pedigree and family ties beyond use of having contact." />
<min value="0" />
<max value="*" />
<constraint>
<key value="1" />
<name value="ContactNeedsDetails" />
<severity value="error" />
<human value="SHALL at least contain a contact's details or a reference to an organization" />
<xpath value="f:name or f:telecom or f:address or f:organization" />
</constraint>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/scopedRole[classCode=CON]" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.extension" />
<definition>
<short value="Additional Content defined by implementations" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.contact.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.contact.relationship" />
<definition>
<short value="The kind of relationship" />
<formal value="The nature of the relationship between the patient and the contact person." />
<min value="0" />
<max value="*" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="ContactRelationship" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/patient-contact-relationship" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="code" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-7, NK1-3" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.name" />
<definition>
<short value="A name associated with the person" />
<formal value="A name associated with the person." />
<min value="0" />
<max value="1" />
<type>
<code value="HumanName" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="name" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-2" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.telecom" />
<definition>
<short value="A contact detail for the person" />
<formal value="A contact detail for the person, e.g. a telephone number or an email address." />
<comments
value="Person may have multiple ways to be contacted with different uses or applicable periods. May need to have options for contacting the person urgently, and also to help with identification." />
<min value="0" />
<max value="*" />
<type>
<code value="Contact" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="telecom" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-5, NK1-6, NK1-40" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.address" />
<definition>
<short value="Address for the contact person" />
<formal value="Address for the contact person." />
<min value="0" />
<max value="1" />
<type>
<code value="Address" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="addr" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-4" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.gender" />
<definition>
<short value="Gender for administrative purposes" />
<formal value="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AdministrativeGender" />
<isExtensible value="true" />
<conformance value="preferred" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/administrative-gender" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/administrativeGender" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-15" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.contact.organization" />
<definition>
<short value="Organization that is associated with the contact" />
<formal value="Organization on behalf of which the contact is acting or for which the contact is working." />
<min value="0" />
<max value="1" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Organization" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="scoper" />
</mapping>
<mapping>
<identity value="v2" />
<map value="NK1-13, NK1-30, NK1-31, NK1-32, NK1-41" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.animal" />
<definition>
<short value="If this patient is an animal (non-human)" />
<formal value="This element has a value if the patient is an animal." />
<comments
value="The animal element is labeled &quot;Is Modifier&quot; since patients may be non-human. Systems SHALL either handle patient details appropriately (e.g. inform users patient is not human) or reject non-human patient records." />
<min value="0" />
<max value="1" />
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value="player[classCode=ANM]" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.animal.extension" />
<definition>
<short value="Additional Content defined by implementations" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.animal.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.animal.species" />
<definition>
<short value="E.g. Dog, Cow" />
<formal value="Identifies the high level categorization of the kind of animal." />
<comments value="If the patient is non-human, at least a species SHALL be specified." />
<min value="1" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AnimalSpecies" />
<isExtensible value="true" />
<conformance value="example" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/animal-species" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="code" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-35" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.animal.breed" />
<definition>
<short value="E.g. Poodle, Angus" />
<formal value="Identifies the detailed categorization of the kind of animal." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AnimalBreed" />
<isExtensible value="true" />
<conformance value="example" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/animal-breeds" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="playedRole[classCode=GEN]/scoper[classCode=ANM, determinerCode=KIND]/code" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-37" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.animal.genderStatus" />
<definition>
<short value="E.g. Neutered, Intact" />
<formal value="Indicates the current state of the animal's reproductive organs." />
<min value="0" />
<max value="1" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="AnimalGenderStatus" />
<isExtensible value="true" />
<conformance value="example" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/animal-genderstatus" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="genderStatusCode" />
</mapping>
<mapping>
<identity value="v2" />
<map value="N/A" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.communication" />
<definition>
<short value="Languages which may be used to communicate with the patient about his or her health" />
<formal value="Languages which may be used to communicate with the patient about his or her health." />
<comments
value="If no language is specified, this *implies* that the default local language is spoken. For animals, language is not a relevant field, and should be absent from the instance." />
<min value="0" />
<max value="*" />
<type>
<code value="CodeableConcept" />
</type>
<isModifier value="false" />
<binding>
<name value="Language" />
<isExtensible value="false" />
<conformance value="required" />
<referenceUri value="http://tools.ietf.org/html/bcp47" />
</binding>
<mapping>
<identity value="rim" />
<map value="player[classCode=PSN|ANM and determinerCode=INSTANCE]/languageCommunication/code" />
</mapping>
<mapping>
<identity value="v2" />
<map value="LAN-2" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.careProvider" />
<definition>
<short value="Patient's nominated care provider" />
<formal value="Patient's nominated care provider." />
<min value="0" />
<max value="*" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Organization" />
</type>
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Practitioner" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="subjectOf.CareEvent.performer.AssignedEntity" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.managingOrganization" />
<definition>
<short value="Organization that is the custodian of the patient record" />
<formal value="Organization that is the custodian of the patient record." />
<min value="0" />
<max value="1" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Organization" />
</type>
<isModifier value="false" />
<mapping>
<identity value="rim" />
<map value="scoper" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.link" />
<definition>
<short value="Link to another patient resource that concerns the same actual person" />
<formal value="Link to another patient resource that concerns the same actual person." />
<comments value="There is no assumption that linked patient records have mutual links." />
<min value="0" />
<max value="*" />
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value="outboundLink" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.link.extension" />
<definition>
<short value="Additional Content defined by implementations" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.link.modifierExtension" />
<definition>
<short value="Extensions that cannot be ignored" />
<formal
value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." />
<comments
value="there can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core simplicity for everyone." />
<synonym value="extensions" />
<synonym value="user content" />
<min value="0" />
<max value="*" />
<type>
<code value="Extension" />
</type>
<isModifier value="false" />
</definition>
</element>
<element>
<path value="Patient.link.other" />
<definition>
<short value="The other patient resource that the link refers to" />
<formal value="The other patient resource that the link refers to." />
<min value="1" />
<max value="1" />
<type>
<code value="ResourceReference" />
<profile value="http://hl7.org/fhir/profiles/Patient" />
</type>
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value="id" />
</mapping>
<mapping>
<identity value="v2" />
<map value="PID-3, MRG-1" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.link.type" />
<definition>
<short value="replace | refer | seealso - type of link" />
<formal value="The type of link between this patient resource and another patient resource." />
<min value="1" />
<max value="1" />
<type>
<code value="code" />
</type>
<isModifier value="true" />
<binding>
<name value="LinkType" />
<isExtensible value="false" />
<conformance value="required" />
<referenceValueSet>
<reference value="http://hl7.org/fhir/vs/link-type" />
</referenceValueSet>
</binding>
<mapping>
<identity value="rim" />
<map value="typeCode" />
</mapping>
</definition>
</element>
<element>
<path value="Patient.active" />
<definition>
<short value="Whether this patient's record is in active use" />
<formal value="Whether this patient record is in active use." />
<comments value="Default is true. If a record is inactive, and linked to an active record, then future patient/person/record updates should occur on the other patient." />
<min value="0" />
<max value="1" />
<type>
<code value="boolean" />
</type>
<isModifier value="true" />
<mapping>
<identity value="rim" />
<map value="statusCode" />
</mapping>
</definition>
</element>
<searchParam>
<name value="_id" />
<type value="token" />
<documentation value="The logical resource id associated with the resource (must be supported by all servers)" />
</searchParam>
<searchParam>
<name value="active" />
<type value="token" />
<documentation value="Whether the patient record is active" />
<xpath value="f:Patient/f:active" />
</searchParam>
<searchParam>
<name value="address" />
<type value="string" />
<documentation value="An address in any kind of address/part of the patient" />
<xpath value="f:Patient/f:address" />
</searchParam>
<searchParam>
<name value="animal-breed" />
<type value="token" />
<documentation value="The breed for animal patients" />
<xpath value="f:Patient/f:animal/f:breed" />
</searchParam>
<searchParam>
<name value="animal-species" />
<type value="token" />
<documentation value="The species for animal patients" />
<xpath value="f:Patient/f:animal/f:species" />
</searchParam>
<searchParam>
<name value="birthdate" />
<type value="date" />
<documentation value="The patient's date of birth" />
<xpath value="f:Patient/f:birthDate" />
</searchParam>
<searchParam>
<name value="family" />
<type value="string" />
<documentation value="A portion of the family name of the patient" />
<xpath value="f:Patient/f:name/f:family" />
</searchParam>
<searchParam>
<name value="gender" />
<type value="token" />
<documentation value="Gender of the patient" />
<xpath value="f:Patient/f:gender" />
</searchParam>
<searchParam>
<name value="given" />
<type value="string" />
<documentation value="A portion of the given name of the patient" />
<xpath value="f:Patient/f:name/f:given" />
</searchParam>
<searchParam>
<name value="identifier" />
<type value="token" />
<documentation value="A patient identifier" />
<xpath value="f:Patient/f:identifier" />
</searchParam>
<searchParam>
<name value="language" />
<type value="token" />
<documentation value="Language code (irrespective of use value)" />
<xpath value="f:Patient/f:communication" />
</searchParam>
<searchParam>
<name value="link" />
<type value="reference" />
<documentation value="All patients linked to the given patient" />
<xpath value="f:Patient/f:link/f:other" />
</searchParam>
<searchParam>
<name value="name" />
<type value="string" />
<documentation value="A portion of either family or given name of the patient" />
<xpath value="f:Patient/f:name" />
</searchParam>
<searchParam>
<name value="phonetic" />
<type value="string" />
<documentation value="A portion of either family or given name using some kind of phonetic matching algorithm" />
</searchParam>
<searchParam>
<name value="provider" />
<type value="reference" />
<documentation value="The organization at which this person is a patient" />
<xpath value="f:Patient/f:managingOrganization" />
</searchParam>
<searchParam>
<name value="telecom" />
<type value="string" />
<documentation value="The value in any kind of telecom details of the patient" />
<xpath value="f:Patient/f:telecom" />
</searchParam>
</structure>
</Profile>

View File

@ -1,121 +0,0 @@
<ValueSet xmlns="http://hl7.org/fhir">
<text>
<status value="generated" />
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Release Date: 2013-12-07</p>
<h2>Description</h2>
<p>
The gender of a person used for adminstrative purposes (as opposed
to
clinical gender)
<br />
</p>
<hr />
<table class="grid">
<tr>
<td>
<b>Level</b>
</td>
<td>
<b>Code</b>
</td>
<td>
<b>Display</b>
</td>
<td>
<b>Definition</b>
</td>
</tr>
<tr>
<td>1</td>
<td>
F
<a name="F">
</a>
</td>
<td>Female</td>
<td>
Female
<br />
</td>
</tr>
<tr>
<td>1</td>
<td>
M
<a name="M">
</a>
</td>
<td>Male</td>
<td>
Male
<br />
</td>
</tr>
<tr>
<td>1</td>
<td>
UN
<a name="UN">
</a>
</td>
<td>Undifferentiated</td>
<td>
The gender of a person could not be uniquely defined as male or
female, such as hermaphrodite.
<br />
</td>
</tr>
</table>
</div>
</text>
<identifier value="http://hl7.org/fhir/v3/vs/AdministrativeGender" />
<name value="v3 Code System AdministrativeGender" />
<publisher value="HL7, Inc" />
<telecom>
<system value="url" />
<value value="http://hl7.org" />
</telecom>
<description
value=" The gender of a person used for adminstrative purposes (as opposed to clinical gender)" />
<status value="active" />
<date value="2013-12-07T00:00:00+11:00" />
<define>
<system value="http://hl7.org/fhir/v3/AdministrativeGender" />
<caseSensitive value="true" />
<concept>
<code value="F" />
<display value="Female" />
<definition value="Female" />
</concept>
<concept>
<code value="M" />
<display value="Male" />
<definition value="Male" />
</concept>
<concept>
<code value="UN" />
<display value="Undifferentiated" />
<definition
value="The gender of a person could not be uniquely defined as male or female, such as hermaphrodite." />
</concept>
</define>
</ValueSet>

View File

@ -0,0 +1,26 @@
<ValueSet xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://hl7.org/fhir ../fhir-single.xsd">
<text>
<status value="generated" />
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</text>
<identifier value="urn:cgta:valueset:providerIdPool" />
<name value="ConnectingGTA Provider ID Namespaces" />
<publisher value="ConnectingGTA" />
<description value="" />
<status value="active" />
<date value="2013-12-07" />
<define>
<system value="urn:cgta:valueset:providerIdPool" />
<caseSensitive value="true" />
<concept>
<code value="urn:oid:1.3.6.1.4.1.12201.1" />
<display value="University Health Network Provider IDs" />
</concept>
<concept>
<code value="urn:oid:2.16.840.1.113883.3.239.23.57.1" />
<display value="Women's College Hospital Provider IDs" />
</concept>
</define>
</ValueSet>

View File

@ -1,39 +0,0 @@
<ValueSet xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../schema/valueset.xsd">
<name value="Marital Status Codes"/>
<publisher value="FHIR Project team"/>
<telecom>
<system value="url"/>
<value value="http://hl7.org/fhir"/>
</telecom>
<description value="This value set defines the set of codes that can be used to indicate the marital status of a person"/>
<status value="draft"/>
<define>
<system value="http://hl7.org/fhir/marital-status"/>
<caseSensitive value="true"/>
<concept>
<!-- work around for missing code in v3 code system - should be temporary, until added in v3 -->
<code value="U"/>
<display value="unmarried"/>
<definition value="The person is not presently married. The marital history is not known or stated"/>
</concept>
</define>
<compose>
<include>
<system value="http://hl7.org/fhir/v3/MaritalStatus"/>
<code value="A"/>
<code value="D"/>
<code value="I"/>
<code value="L"/>
<code value="M"/>
<code value="P"/>
<code value="S"/>
<code value="T"/>
<code value="W"/>
</include>
<include>
<system value="http://hl7.org/fhir/v3/NullFlavor"/>
<code value="UNK"/>
</include>
</compose>
</ValueSet>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,272 @@
<?xml version="1.0"?>
<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" targetNamespace="http://www.w3.org/XML/1998/namespace" xml:lang="en">
<!-- Note: When using this schema with some tools, it may also be necessary to declare xmlns:xml="http://www.w3.org/XML/1998/namespace", however this causes performance issues with other tools and thus is not in the base schemas. -->
<xs:annotation>
<xs:documentation>
<div>
<h1>About the XML namespace</h1>
<div class="bodytext">
<p>
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
</p>
<p>
See <a href="http://www.w3.org/XML/1998/namespace.html">
http://www.w3.org/XML/1998/namespace.html</a> and
<a href="http://www.w3.org/TR/REC-xml">
http://www.w3.org/TR/REC-xml</a> for information
about this namespace.
</p>
<p>
Note that local names in this namespace are intended to be
defined only by the World Wide Web Consortium or its subgroups.
The names currently defined in this namespace are listed below.
They should not be used with conflicting semantics by any Working
Group, specification, or document instance.
</p>
<p>
See further below in this document for more information about <a href="#usage">how to refer to this schema document from your own
XSD schema documents</a> and about <a href="#nsversioning">the
namespace-versioning policy governing this schema document</a>.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:attribute name="lang">
<xs:annotation>
<xs:documentation>
<div>
<h3>lang (as an attribute name)</h3>
<p>
denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.</p>
</div>
<div>
<h4>Notes</h4>
<p>
Attempting to install the relevant ISO 2- and 3-letter
codes as the enumerated possible values is probably never
going to be a realistic possibility.
</p>
<p>
See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
and the IANA language subtag registry at
<a href="http://www.iana.org/assignments/language-subtag-registry">
http://www.iana.org/assignments/language-subtag-registry</a>
for further information.
</p>
<p>
The union allows for the 'un-declaration' of xml:lang with
the empty string.
</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:union memberTypes="xs:language">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="space">
<xs:annotation>
<xs:documentation>
<div>
<h3>space (as an attribute name)</h3>
<p>
denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.</p>
</div>
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:NCName">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="base" type="xs:anyURI">
<xs:annotation>
<xs:documentation>
<div>
<h3>base (as an attribute name)</h3>
<p>
denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.</p>
<p>
See <a href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="id" type="xs:ID">
<xs:annotation>
<xs:documentation>
<div>
<h3>id (as an attribute name)</h3>
<p>
denotes an attribute whose value
should be interpreted as if declared to be of type ID.
This name is reserved by virtue of its definition in the
xml:id specification.</p>
<p>
See <a href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
for information about this attribute.
</p>
</div>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup name="specialAttrs">
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute ref="xml:space"/>
<xs:attribute ref="xml:id"/>
</xs:attributeGroup>
<xs:annotation>
<xs:documentation>
<div>
<h3>Father (in any context at all)</h3>
<div class="bodytext">
<p>
denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
</p>
<blockquote>
<p>
In appreciation for his vision, leadership and
dedication the W3C XML Plenary on this 10th day of
February, 2000, reserves for Jon Bosak in perpetuity
the XML name "xml:Father".
</p>
</blockquote>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div xml:id="usage" id="usage">
<h2>
<a name="usage">About this schema document</a>
</h2>
<div class="bodytext">
<p>
This schema defines attributes and an attribute group suitable
for use by schemas wishing to allow <code>xml:base</code>,
<code>xml:lang</code>, <code>xml:space</code> or
<code>xml:id</code> attributes on elements they define.
</p>
<p>
To enable this, such a schema must import this schema for
the XML namespace, e.g. as follows:
</p>
<pre>
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
</pre>
<p>
or
</p>
<pre>
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
</pre>
<p>
Subsequently, qualified reference to any of the attributes or the
group defined below will have the desired effect, e.g.
</p>
<pre>
&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>
</pre>
<p>
will define a type which will schema-validate an instance element
with any of those attributes.
</p>
</div>
</div>
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>
<div id="nsversioning" xml:id="nsversioning">
<h2>
<a name="nsversioning">Versioning policy for this schema document</a>
</h2>
<div class="bodytext">
<p>
In keeping with the XML Schema WG's standard versioning
policy, this schema document will persist at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a>.
</p>
<p>
At the date of issue it can also be found at
<a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd</a>.
</p>
<p>
The schema document at that URI may however change in the future,
in order to remain compatible with the latest version of XML
Schema itself, or with the XML namespace itself. In other words,
if the XML Schema or XML namespaces change, the version of this
document at <a href="http://www.w3.org/2001/xml.xsd">
http://www.w3.org/2001/xml.xsd
</a>
will change accordingly; the version at
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd
</a>
will not change.
</p>
<p>
Previous dated (and unchanging) versions of this schema
document are at:
</p>
<ul>
<li>
<a href="http://www.w3.org/2009/01/xml.xsd">
http://www.w3.org/2009/01/xml.xsd</a>
</li>
<li>
<a href="http://www.w3.org/2007/08/xml.xsd">
http://www.w3.org/2007/08/xml.xsd</a>
</li>
<li>
<a href="http://www.w3.org/2004/10/xml.xsd">
http://www.w3.org/2004/10/xml.xsd</a>
</li>
<li>
<a href="http://www.w3.org/2001/03/xml.xsd">
http://www.w3.org/2001/03/xml.xsd</a>
</li>
</ul>
</div>
</div>
</xs:documentation>
</xs:annotation>
</xs:schema>