move test cases to fhir-test-cases repository

This commit is contained in:
Grahame Grieve 2019-10-28 18:06:41 +11:00
commit efd20a22fe
1199 changed files with 890 additions and 309644 deletions

View File

@ -260,6 +260,16 @@ public class Mimic14Importer {
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(dest), bnd);
}
/**
* loinc COE 600-7 DATE TIME + CODE FOR OBSERVED - UPCODE TO snomed?
*
* Sensitivity = observation panel code of
* code =
* @param src
* @param dest
* @throws FileNotFoundException
* @throws IOException
*/
private void processMicroEvents(String src, String dest) throws FileNotFoundException, IOException {
System.out.print("Processing Micro Events... ");
CSVReader csv = new CSVReader(new FileInputStream(src));

View File

@ -116,7 +116,7 @@ public class ProfileComparer implements ProfileKnowledgeProvider {
this.folder = folder;
if (!new File(Utilities.path(folder, "conparison-zip-marker.bin")).exists()) {
String f = Utilities.path(folder, "comparison.zip");
download("https://www.fhir.org/archive/comparison.zip", f);
download("http://www.fhir.org/archive/comparison.zip", f);
unzip(f, folder);
}
}

View File

@ -2595,14 +2595,26 @@ public class ProfileUtilities extends TranslatingUtilities {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
gen.setTranslator(getTranslator());
TableModel model = gen.initNormalTable(corePath, false, true);
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
List<ElementDefinition> list = new ArrayList<>();
if (diff)
list.addAll(profile.getDifferential().getElement());
else
list.addAll(profile.getSnapshot().getElement());
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
profiles.add(profile);
if (list.isEmpty()) {
ElementDefinition root = new ElementDefinition().setPath(profile.getType());
root.setId(profile.getType());
list.add(root);
} else {
if (list.get(0).getPath().contains(".")) {
ElementDefinition root = new ElementDefinition().setPath(profile.getType());
root.setId(profile.getType());
list.add(0, root);
}
}
if (diff)
insertMissingSparseElements(list);
genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants, null);
try {
return gen.generate(model, imagePath, 0, outputTracker);
@ -2612,6 +2624,46 @@ public class ProfileUtilities extends TranslatingUtilities {
}
private void insertMissingSparseElements(List<ElementDefinition> list) {
int i = 1;
while (i < list.size()) {
String[] pathCurrent = list.get(i).getPath().split("\\.");
String[] pathLast = list.get(i-1).getPath().split("\\.");
int firstDiff = 0; // the first entry must be a match
while (firstDiff < pathCurrent.length && firstDiff < pathLast.length && pathCurrent[firstDiff].equals(pathLast[firstDiff])) {
firstDiff++;
}
if (!(isSibling(pathCurrent, pathLast, firstDiff) || isChild(pathCurrent, pathLast, firstDiff))) {
// now work backwards down to lastMatch inserting missing path nodes
for (int index = pathCurrent.length-2; index >= firstDiff; index--) {
ElementDefinition root = new ElementDefinition().setPath(makePath(pathCurrent, index));
root.setId(root.getPath());
list.add(i, root);
}
}
i++;
}
}
private boolean isSibling(String[] pathCurrent, String[] pathLast, int firstDiff) {
return pathCurrent.length == pathLast.length && firstDiff == pathCurrent.length-1;
}
private boolean isChild(String[] pathCurrent, String[] pathLast, int firstDiff) {
return pathCurrent.length == pathLast.length+1 && firstDiff == pathLast.length;
}
private String makePath(String[] pathCurrent, int index) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(".");
for (int i = 0; i <= index; i++) {
b.append(pathCurrent[i]);
}
return b.toString();
}
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true);
gen.setTranslator(getTranslator());

View File

@ -33,6 +33,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.fhir.ucum.UcumEssenceService;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.exceptions.FHIRException;
@ -44,11 +45,13 @@ import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.PackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.google.common.base.Charsets;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
@ -67,7 +70,7 @@ public class TestingUtilities {
try {
pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.core", "4.0.0"));
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.resourceNameToFile("ucum", "ucum-essence.xml")));
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.loadTestResourceStream("ucum", "ucum-essence.xml")));
fcontext.setExpansionProfile(new Parameters());
} catch (Exception e) {
throw new Error(e);
@ -439,14 +442,83 @@ public class TestingUtilities {
return null;
}
public static boolean findTestResource(String... paths) throws IOException {
System.out.println(System.getProperty("user.dir"));
if (new File("../../fhir-test-cases").exists()) {
String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths));
return new File(n).exists();
} else {
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
try {
InputStream inputStream = TestingUtilities.class.getResourceAsStream(classpath);
return inputStream != null;
} catch (Throwable t) {
return false;
}
}
}
public static String loadTestResource(String... paths) throws IOException {
System.out.println(System.getProperty("user.dir"));
if (new File("../../fhir-test-cases").exists()) {
String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths));
// ok, we'll resolve this locally
return TextFile.fileToString(new File(n));
} else {
// resolve from the package
String contents;
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
try (InputStream inputStream = TestingUtilities.class.getResourceAsStream(classpath)) {
if (inputStream == null) {
throw new IOException("Can't find file on classpath: " + classpath);
}
contents = IOUtils.toString(inputStream, Charsets.UTF_8);
}
return contents;
}
}
public static String resourceNameToFile(String name) throws IOException {
return Utilities.path(System.getProperty("user.dir"), "src", "test", "resources", name);
public static InputStream loadTestResourceStream(String... paths) throws IOException {
System.out.println(System.getProperty("user.dir"));
if (new File("../../fhir-test-cases").exists()) {
String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths));
return new FileInputStream(n);
} else {
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
return TestingUtilities.class.getResourceAsStream(classpath);
}
}
public static byte[] loadTestResourceBytes(String... paths) throws IOException {
System.out.println(System.getProperty("user.dir"));
if (new File("../../fhir-test-cases").exists()) {
String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths));
return TextFile.fileToBytes(n);
} else {
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
return TextFile.streamToBytes(TestingUtilities.class.getResourceAsStream(classpath));
}
}
public static String resourceNameToFile(String subFolder, String name) throws IOException {
return Utilities.path(System.getProperty("user.dir"), "src", "test", "resources", subFolder, name);
public static String tempFile(String folder, String name) throws IOException {
String tmp = tempFolder(folder);
return Utilities.path(tmp, name);
}
public static String tempFolder(String name) throws IOException {
if (new File("C:\\temp").exists()) {
String path = Utilities.path("C:\\temp", name);
Utilities.createDirectory(path);
return path;
} else if (new File("/tmp").exists()) {
String path = Utilities.path("/tmp", name);
Utilities.createDirectory(path);
return path;
} else {
String path = Utilities.path(System.getProperty("java.io.tmpdir"), name);
Utilities.createDirectory(path);
return path;
}
}
}

View File

@ -26,14 +26,17 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@ -52,7 +55,9 @@ import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.cache.NpmPackageIndexBuilder;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -63,7 +68,7 @@ public class NPMPackageGenerator {
public enum Category {
RESOURCE, EXAMPLE, OPENAPI, SCHEMATRON, RDF, OTHER, TOOL, TEMPLATE, JEKYLL;
private String getDirectory() {
switch (this) {
case RESOURCE: return "/package/";
@ -88,7 +93,9 @@ public class NPMPackageGenerator {
private GzipCompressorOutputStream gzipOutputStream;
private JsonObject packageJ;
private JsonObject packageManifest;
private NpmPackageIndexBuilder indexer;
public NPMPackageGenerator(String destFile, String canonical, String url, PackageType kind, ImplementationGuide ig, Date date) throws FHIRException, IOException {
super();
this.destFile = destFile;
@ -98,7 +105,7 @@ public class NPMPackageGenerator {
fhirVersion.add(v.asStringValue());
buildPackageJson(canonical, kind, url, date, ig, fhirVersion);
}
public static NPMPackageGenerator subset(NPMPackageGenerator master, String destFile, String id, String name, Date date) throws FHIRException, IOException {
JsonObject p = master.packageJ.deepCopy();
p.remove("name");
@ -110,14 +117,14 @@ public class NPMPackageGenerator {
return new NPMPackageGenerator(destFile, p, date);
}
public NPMPackageGenerator(String destFile, String canonical, String url, PackageType kind, ImplementationGuide ig, Date date, List<String> fhirVersion) throws FHIRException, IOException {
super();
this.destFile = destFile;
start();
buildPackageJson(canonical, kind, url, date, ig, fhirVersion);
}
public NPMPackageGenerator(String destFile, JsonObject npm, Date date) throws FHIRException, IOException {
super();
String dt = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
@ -135,13 +142,12 @@ public class NPMPackageGenerator {
addFile(Category.RESOURCE, "package.json", json.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
}
}
private void buildPackageJson(String canonical, PackageType kind, String web, Date date, ImplementationGuide ig, List<String> fhirVersion) throws FHIRException, IOException {
String dtHuman = new SimpleDateFormat("EEE, MMM d, yyyy HH:mmZ", new Locale("en", "US")).format(date);
String dt = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
if (!ig.hasPackageId())
b.append("packageId");
@ -218,7 +224,7 @@ public class NPMPackageGenerator {
packageManifest.addProperty("fhirVersion", fhirVersion.toString());
packageManifest.addProperty("date", dt);
packageManifest.addProperty("name", ig.getPackageId());
}
@ -256,6 +262,8 @@ public class NPMPackageGenerator {
bufferedOutputStream = new BufferedOutputStream(OutputStream);
gzipOutputStream = new GzipCompressorOutputStream(bufferedOutputStream);
tar = new TarArchiveOutputStream(gzipOutputStream);
indexer = new NpmPackageIndexBuilder();
indexer.start();
}
@ -270,10 +278,14 @@ public class NPMPackageGenerator {
tar.putArchiveEntry(entry);
tar.write(content);
tar.closeArchiveEntry();
if(cat == Category.RESOURCE) {
indexer.seeFile(name, content);
}
}
}
public void finish() throws IOException {
buildIndexJson();
tar.finish();
tar.close();
gzipOutputStream.close();
@ -286,6 +298,11 @@ public class NPMPackageGenerator {
TextFile.stringToFile(json, Utilities.changeFileExt(destFile, ".manifest.json"), false);
}
private void buildIndexJson() throws IOException {
byte[] content = indexer.build().getBytes(Charset.forName("UTF-8"));
addFile(Category.RESOURCE, ".index.json", content);
}
public String filename() {
return destFile;
}
@ -316,6 +333,6 @@ public class NPMPackageGenerator {
}
}
}
}

View File

@ -7,6 +7,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
@ -42,11 +43,11 @@ public class CDARoundTripTests {
public void testCDA() throws FHIRFormatError, DefinitionException, FileNotFoundException, IOException, FHIRException {
try {
String fileSource = TestingUtilities.resourceNameToFile("cda", "cda-original.xml");
String roundTrip = TestingUtilities.resourceNameToFile("cda", "cda-roundtrip.xml");
String jsonRoundTrip = TestingUtilities.resourceNameToFile("cda", "cda-roundtrip.json");
InputStream fileSource = TestingUtilities.loadTestResourceStream("cda", "cda-original.xml");
String roundTrip = TestingUtilities.tempFile("cda", "cda-roundtrip.xml");
String jsonRoundTrip = TestingUtilities.tempFile("cda", "cda-roundtrip.json");
Element e = Manager.parse(context, new FileInputStream(fileSource), FhirFormat.XML);
Element e = Manager.parse(context, fileSource, FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream(roundTrip), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(jsonRoundTrip), FhirFormat.JSON, OutputStyle.PRETTY, null);

View File

@ -6,6 +6,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@ -54,7 +55,7 @@ public class FHIRMappingLanguageTests implements ITransformerServices {
@Parameters(name = "{index}: {0}")
public static Iterable<Object[]> data()
throws FileNotFoundException, IOException, ParserConfigurationException, SAXException {
Document tests = XMLUtil.parseFileToDom(TestingUtilities.resourceNameToFile("fml", "manifest.xml"));
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "fml", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Object[]> objects = new ArrayList<Object[]>();
while (test != null && test.getNodeName().equals("test")) {
@ -90,10 +91,10 @@ public class FHIRMappingLanguageTests implements ITransformerServices {
@Test
public void test() throws Exception {
String fileSource = TestingUtilities.resourceNameToFile("fml", source);
String fileMap = TestingUtilities.resourceNameToFile("fml", map);
String fileOutput = TestingUtilities.resourceNameToFile("fml", output);
String fileOutputRes = TestingUtilities.resourceNameToFile("fml", output)+".out";
InputStream fileSource = TestingUtilities.loadTestResourceStream("r5", "fml", source);
InputStream fileMap = TestingUtilities.loadTestResourceStream("r5", "fml", map);
String fileOutput = TestingUtilities.tempFile("fml", output);
String fileOutputRes = TestingUtilities.tempFile("fml", output)+".out";
outputs.clear();
@ -103,8 +104,8 @@ public class FHIRMappingLanguageTests implements ITransformerServices {
try {
StructureMapUtilities scu = new StructureMapUtilities(context, this);
org.hl7.fhir.r5.elementmodel.Element src = Manager.parse(context,
new ByteArrayInputStream(TextFile.fileToBytes(fileSource)), FhirFormat.JSON);
StructureMap structureMap = scu.parse(TextFile.fileToString(fileMap), name);
new ByteArrayInputStream(TextFile.streamToBytes(fileSource)), FhirFormat.JSON);
StructureMap structureMap = scu.parse(TextFile.streamToString(fileMap), name);
String typeName = scu.getTargetType(structureMap).getType();
resource = ResourceFactory.createResource(typeName);
scu.transform(null, src, structureMap, resource);

View File

@ -102,7 +102,7 @@ public class FHIRPathTests {
@Parameters(name = "{index}: file {0}")
public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException {
Document dom = XMLUtil.parseFileToDom(TestingUtilities.resourceNameToFile("fhirpath", "tests-fhir-r4.xml"));
Document dom = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "fhirpath", "tests-fhir-r4.xml"));
List<Element> list = new ArrayList<Element>();
List<Element> groups = new ArrayList<Element>();
@ -167,7 +167,7 @@ public class FHIRPathTests {
else {
res = resources.get(input);
if (res == null) {
res = new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile(input)));
res = new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", input));
resources.put(input, res);
}
fp.check(res, res.getResourceType().toString(), res.getResourceType().toString(), node);

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.r5.test;
import org.apache.poi.util.IOUtils;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
@ -31,7 +32,9 @@ import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@ -42,7 +45,7 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
@Parameters(name = "{index}: {0}")
public static Iterable<Object[]> data() throws FileNotFoundException, IOException, ParserConfigurationException, SAXException {
Document tests = XMLUtil.parseFileToDom(TestingUtilities.resourceNameToFile("graphql", "manifest.xml"));
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "graphql", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Object[]> objects = new ArrayList<Object[]>();
while (test != null && test.getNodeName().equals("test")) {
@ -71,22 +74,22 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
@Test
public void test() throws Exception {
String filename = null;
InputStream stream = null;
if (!Utilities.noString(context)) {
String[] parts = context.split("/");
if (parts.length != 3)
throw new Exception("not done yet "+source+" "+output+" "+context);
if (!Utilities.noString(resource))
filename = TestingUtilities.resourceNameToFile(resource+".xml");
stream = TestingUtilities.loadTestResourceStream("r5", resource+".xml");
else
filename = TestingUtilities.resourceNameToFile(parts[0].toLowerCase()+"-"+parts[1].toLowerCase()+".xml");
stream = TestingUtilities.loadTestResourceStream("r5", parts[0].toLowerCase()+"-"+parts[1].toLowerCase()+".xml");
}
GraphQLEngine gql = new GraphQLEngine(TestingUtilities.context());
gql.setServices(this);
if (!Utilities.noString(filename))
gql.setFocus(new XmlParser().parse(new FileInputStream(filename)));
gql.setGraphQL(Parser.parseFile(TestingUtilities.resourceNameToFile("graphql", source)));
if (stream != null)
gql.setFocus(new XmlParser().parse(stream));
gql.setGraphQL(Parser.parse(TestingUtilities.loadTestResource("r5", "graphql", source)));
gql.getGraphQL().setOperationName(operation);
gql.getGraphQL().getVariables().add(new Argument("var", new NameValue("true")));
boolean ok = false;
@ -105,8 +108,10 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
StringBuilder str = new StringBuilder();
gql.getOutput().setWriteWrapper(false);
gql.getOutput().write(str, 0);
TextFile.stringToFile(str.toString(), TestingUtilities.resourceNameToFile("graphql", output+".out"));
msg = TestingUtilities.checkJsonIsSame(TestingUtilities.resourceNameToFile("graphql", output+".out"), TestingUtilities.resourceNameToFile("graphql", output));
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "graphql", source), new FileOutputStream(TestingUtilities.tempFile("graphql", source)));
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "graphql", output), new FileOutputStream(TestingUtilities.tempFile("graphql", output)));
TextFile.stringToFile(str.toString(), TestingUtilities.tempFile("graphql", output+".out"));
msg = TestingUtilities.checkJsonIsSame(TestingUtilities.tempFile("graphql", output+".out"), TestingUtilities.tempFile("graphql", output));
assertTrue(msg, Utilities.noString(msg));
}
else
@ -116,11 +121,11 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
@Override
public Resource lookup(Object appInfo, String type, String id) throws FHIRException {
try {
String filename = TestingUtilities.resourceNameToFile(type.toLowerCase()+'-'+id.toLowerCase()+".xml");
if (new File(filename).exists())
return new XmlParser().parse(new FileInputStream(filename));
else
if (TestingUtilities.findTestResource("r5", type.toLowerCase()+'-'+id.toLowerCase()+".xml")) {
return new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", type.toLowerCase()+'-'+id.toLowerCase()+".xml"));
} else {
return null;
}
} catch (Exception e) {
throw new FHIRException(e);
}
@ -139,9 +144,8 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
}
} else {
String[] parts = reference.getReferenceElement().getValue().split("/");
String filename = TestingUtilities.resourceNameToFile(parts[0].toLowerCase()+'-'+parts[1].toLowerCase()+".xml");
if (new File(filename).exists())
return new ReferenceResolution(null, new XmlParser().parse(new FileInputStream(filename)));
if (TestingUtilities.findTestResource("r5", parts[0].toLowerCase()+'-'+parts[1].toLowerCase()+".xml"))
return new ReferenceResolution(null, new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", parts[0].toLowerCase()+'-'+parts[1].toLowerCase()+".xml")));
}
return null;
} catch (Exception e) {
@ -153,10 +157,10 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
public void listResources(Object appInfo, String type, List<Argument> searchParams, List<IBaseResource> matches) throws FHIRException {
try {
if (type.equals("Condition"))
matches.add(new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("condition-example.xml"))));
matches.add(new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "condition-example.xml")));
else if (type.equals("Patient")) {
matches.add(new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("patient-example.xml"))));
matches.add(new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("patient-example-xds.xml"))));
matches.add(new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "patient-example.xml")));
matches.add(new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "patient-example-xds.xml")));
}
} catch (Exception e) {
throw new FHIRException(e);
@ -175,10 +179,10 @@ public class GraphQLEngineTests implements IGraphQLStorageServices {
bl.setUrl("http://test.fhir.org/r4/Patient?_format=text/xhtml&search-id=77c97e03-8a6c-415f-a63d-11c80cf73f&&active=true&_sort=_id&search-offset=0&_count=50");
BundleEntryComponent be = bnd.addEntry();
be.setFullUrl("http://hl7.org/fhir/Patient/example");
be.setResource(new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.resourceNameToFile("patient-example.xml")))));
be.setResource(new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "patient-example.xml")));
be = bnd.addEntry();
be.setFullUrl("http://hl7.org/fhir/Patient/example");
be.setResource(new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.resourceNameToFile("patient-example-xds.xml")))));
be.setResource(new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "patient-example-xds.xml")));
be.getSearch().setScore(0.5);
be.getSearch().setMode(SearchEntryMode.MATCH);
bnd.setTotal(50);

View File

@ -24,7 +24,7 @@ public class GraphQLParserTests {
@Parameters(name = "{index}: {0}")
public static Iterable<Object[]> data() throws FileNotFoundException, IOException {
String src = TextFile.fileToString(TestingUtilities.resourceNameToFile("graphql", "parser-tests.gql"));
String src = TestingUtilities.loadTestResource("r5", "graphql", "parser-tests.gql");
String[] tests = src.split("###");
int i = 0;
for (String s : tests)

View File

@ -44,7 +44,7 @@ public class LiquidEngineTests implements ILiquidEngineIcludeResolver {
@Parameters(name = "{index}: file{0}")
public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException {
testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(TestingUtilities.resourceNameToFile("liquid", "liquid-tests.json")));
testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TestingUtilities.loadTestResource("r5", "liquid", "liquid-tests.json"));
JsonArray tests = testdoc.getAsJsonArray("tests");
List<Object[]> objects = new ArrayList<Object[]>(tests.size());
for (JsonElement n : tests) {
@ -76,8 +76,7 @@ public class LiquidEngineTests implements ILiquidEngineIcludeResolver {
private Resource loadResource() throws IOException, FHIRFormatError {
String name = test.get("focus").getAsString();
if (!resources.containsKey(name)) {
String fn = TestingUtilities.resourceNameToFile((name.replace("/", "-")+".xml").toLowerCase());
resources.put(name, new XmlParser().parse(new FileInputStream(fn)));
resources.put(name, new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", (name.replace("/", "-")+".xml").toLowerCase())));
}
return resources.get(test.get("focus").getAsString());
}

View File

@ -4,6 +4,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.exceptions.FHIRException;
@ -35,14 +36,14 @@ public class NarrativeGeneratorTests {
@Test
public void test() throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException {
process(TestingUtilities.resourceNameToFile("questionnaireresponse-example-f201-lifelines.xml"));
process(TestingUtilities.loadTestResourceStream("r5", "questionnaireresponse-example-f201-lifelines.xml"));
}
private void process(String path) throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException {
private void process(InputStream stream) throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException {
XmlParser p = new XmlParser();
DomainResource r = (DomainResource) p.parse(new FileInputStream(path));
DomainResource r = (DomainResource) p.parse(stream);
gen.generate(r, null);
FileOutputStream s = new FileOutputStream(TestingUtilities.resourceNameToFile("gen", "gen.xml"));
FileOutputStream s = new FileOutputStream(TestingUtilities.tempFile("gen", "gen.xml"));
new XmlParser().compose(s, r, true);
s.close();

View File

@ -4,6 +4,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.formats.JsonParser;
@ -19,22 +20,22 @@ public class OpenApiGeneratorTest {
@Test
public void testBase1() throws IOException, FHIRFormatError {
String sfn = TestingUtilities.resourceNameToFile("openapi", "cs-base.json");
String dfn = TestingUtilities.resourceNameToFile("openapi", "swagger-base.json");
InputStream sfn = TestingUtilities.loadTestResourceStream("r5", "openapi", "cs-base.json");
String dfn = TestingUtilities.tempFile("openapi", "swagger-base.json");
run(sfn, dfn);
}
@Test
public void testBase2() throws FHIRFormatError, FileNotFoundException, IOException {
String sfn = TestingUtilities.resourceNameToFile("openapi", "cs-base2.json");
String dfn = TestingUtilities.resourceNameToFile("openapi", "swagger-base2.json");
InputStream sfn = TestingUtilities.loadTestResourceStream("r5", "openapi", "cs-base2.json");
String dfn = TestingUtilities.tempFile("openapi", "swagger-base2.json");
run(sfn, dfn);
}
public void run(String sfn, String dfn) throws IOException, FHIRFormatError, FileNotFoundException {
CapabilityStatement cs = (CapabilityStatement) new JsonParser().parse(new FileInputStream(sfn));
public void run(InputStream sfn, String dfn) throws IOException, FHIRFormatError, FileNotFoundException {
CapabilityStatement cs = (CapabilityStatement) new JsonParser().parse(sfn);
Writer oa = new Writer(new FileOutputStream(dfn));
OpenApiGenerator gen = new OpenApiGenerator(TestingUtilities.context(), cs, oa);
gen.generate("test-lic", "http://spdx.org/licenses/test-lic.html");

View File

@ -8,6 +8,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
@ -33,9 +34,10 @@ public class ResourceRoundTripTests {
@Test
public void test() throws FileNotFoundException, IOException, FHIRException, EOperationOutcome, UcumException {
Resource res = new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("unicode.xml")));
Resource res = new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"));
new NarrativeGenerator("", "", TestingUtilities.context()).generate((DomainResource) res, null);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.resourceNameToFile("gen", "unicode.out.xml")), res);
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"), new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.xml")));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.out.xml")), res);
}

View File

@ -14,6 +14,7 @@ import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
@ -165,16 +166,16 @@ public class SnapShotGenerationTests {
this.output = output;
}
public void load() throws FHIRFormatError, FileNotFoundException, IOException {
if (new File(TestingUtilities.resourceNameToFile("snapshot-generation", id+"-input.json")).exists())
source = (StructureDefinition) new JsonParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("snapshot-generation", id+"-input.json")));
if (TestingUtilities.findTestResource("r5", "snapshot-generation", id+"-input.json"))
source = (StructureDefinition) new JsonParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id+"-input.json"));
else
source = (StructureDefinition) new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("snapshot-generation", id+"-input.xml")));
source = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id+"-input.xml"));
if (!fail)
expected = (StructureDefinition) new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("snapshot-generation", id+"-expected.xml")));
expected = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", id+"-expected.xml"));
if (!Utilities.noString(include))
included = (StructureDefinition) new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("snapshot-generation", include+".xml")));
included = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", include+".xml"));
if (!Utilities.noString(register)) {
included = (StructureDefinition) new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("snapshot-generation", register+".xml")));
included = (StructureDefinition) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", register+".xml"));
}
}
}
@ -373,7 +374,7 @@ public class SnapShotGenerationTests {
public static Iterable<Object[]> data() throws ParserConfigurationException, IOException, FHIRFormatError, SAXException {
SnapShotGenerationTestsContext context = new SnapShotGenerationTestsContext();
Document tests = XMLUtil.parseFileToDom(TestingUtilities.resourceNameToFile("snapshot-generation", "manifest.xml"));
Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "snapshot-generation", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Object[]> objects = new ArrayList<Object[]>();
while (test != null && test.getNodeName().equals("test")) {
@ -440,7 +441,8 @@ public class SnapShotGenerationTests {
pu.sortDifferential(base, test.getOutput(), test.getOutput().getUrl(), errors);
if (!errors.isEmpty())
throw new FHIRException(errors.get(0));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.resourceNameToFile("snapshot-generation", test.getId()+"-actual.xml")), test.getOutput());
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId()+"-expected.xml"), new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId()+"-expected.xml")));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId()+"-actual.xml")), test.getOutput());
Assert.assertTrue("Output does not match expected", test.expected.equalsDeep(test.output));
}
@ -482,7 +484,8 @@ public class SnapShotGenerationTests {
new NarrativeGenerator("", "http://hl7.org/fhir", TestingUtilities.context()).setPkp(new TestPKP()).generate(output, null);
test.output = output;
TestingUtilities.context().cacheResource(output);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.resourceNameToFile("snapshot-generation", test.getId()+"-actual.xml")), output);
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId()+"-expected.xml"), new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId()+"-expected.xml")));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId()+"-actual.xml")), output);
StructureDefinition t1 = test.expected.copy();
t1.setText(null);
StructureDefinition t2 = test.output.copy();

View File

@ -40,8 +40,8 @@ public class StructureMapUtilitiesTest implements ITransformerServices{
throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException {
StructureMapUtilities scu = new StructureMapUtilities(context, this);
String fileMap = TestingUtilities.resourceNameToFile("fml", "ActivityDefinition.map");
StructureMap structureMap = scu.parse(TextFile.fileToString(fileMap), "ActivityDefinition3To4");
String fileMap = TestingUtilities.loadTestResource("r5", "fml", "ActivityDefinition.map");
StructureMap structureMap = scu.parse(fileMap, "ActivityDefinition3To4");
// StructureMap/ActivityDefinition3to4: StructureMap.group[3].rule[2].name error id value '"expression"' is not valid
assertEquals("expression",structureMap.getGroup().get(2).getRule().get(1).getName());

View File

@ -1,77 +0,0 @@
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
<http://hl7.org/fhir/Bundle/bundle-example> a fhir:Bundle;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "bundle-example"];
fhir:Resource.meta [
fhir:Meta.lastUpdated [ fhir:value "2014-08-18T01:43:30Z"^^xsd:dateTime ]
];
fhir:Bundle.type [ fhir:value "searchset"];
fhir:Bundle.total [ fhir:value "3"^^xsd:nonNegativeInteger];
fhir:Bundle.link [
fhir:index 0;
fhir:Bundle.link.relation [ fhir:value "self" ];
fhir:Bundle.link.url [ fhir:value "https://example.com/base/MedicationRequest?patient=347&_include=MedicationRequest.medication&_count=2" ]
], [
fhir:index 1;
fhir:Bundle.link.relation [ fhir:value "next" ];
fhir:Bundle.link.url [ fhir:value "https://example.com/base/MedicationRequest?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2" ]
];
fhir:Bundle.entry [
fhir:index 0;
fhir:Bundle.entry.fullUrl [ fhir:value "https://example.com/base/MedicationRequest/3123" ];
fhir:Bundle.entry.resource <https://example.com/base/MedicationRequest/3123>;
fhir:Bundle.entry.search [
fhir:Bundle.entry.search.mode [ fhir:value "match" ];
fhir:Bundle.entry.search.score [ fhir:value "1"^^xsd:decimal ]
]
], [
fhir:index 1;
fhir:Bundle.entry.fullUrl [ fhir:value "https://example.com/base/Medication/example" ];
fhir:Bundle.entry.resource <https://example.com/base/Medication/example>;
fhir:Bundle.entry.search [
fhir:Bundle.entry.search.mode [ fhir:value "include" ]
]
] .
<https://example.com/base/MedicationRequest/3123> a fhir:MedicationRequest;
fhir:Resource.id [ fhir:value "3123"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ];
fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: 3123</p><p><b>status</b>: unknown</p><p><b>intent</b>: order</p><p><b>medication</b>: <a>Medication/example</a></p><p><b>subject</b>: <a>Patient/347</a></p></div>"
];
fhir:MedicationRequest.status [ fhir:value "unknown"];
fhir:MedicationRequest.intent [ fhir:value "order"];
fhir:MedicationRequest.medicationReference [
fhir:link <http://hl7.org/fhir/Medication/example>;
fhir:Reference.reference [ fhir:value "Medication/example" ]
];
fhir:MedicationRequest.subject [
fhir:link <http://hl7.org/fhir/Patient/347>;
fhir:Reference.reference [ fhir:value "Patient/347" ]
] .
<http://hl7.org/fhir/Medication/example> a fhir:Medication .
<http://hl7.org/fhir/Patient/347> a fhir:Patient .
<https://example.com/base/Medication/example> a fhir:Medication;
fhir:Resource.id [ fhir:value "example"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ];
fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: example</p></div>"
] .
# - ontology header ------------------------------------------------------------
<http://hl7.org/fhir/Bundle/bundle-example.ttl> a owl:Ontology;
owl:imports fhir:fhir.ttl;
owl:versionIRI <http://build.fhir.org/Bundle/bundle-example.ttl> .
# -------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><Condition xmlns="http://hl7.org/fhir">
<id value="example"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">Severe burn of left ear (Date: 24-May 2012)</div>
</text>
<clinicalStatus>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
<code value="active"/>
</coding>
</clinicalStatus>
<verificationStatus>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/condition-ver-status"/>
<code value="confirmed"/>
</coding>
</verificationStatus>
<category>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/condition-category"/>
<code value="encounter-diagnosis"/>
<display value="Encounter Diagnosis"/>
</coding>
<!-- and also a SNOMED CT coding -->
<coding>
<system value="http://snomed.info/sct"/>
<code value="439401001"/>
<display value="Diagnosis"/>
</coding>
</category>
<severity>
<coding>
<system value="http://snomed.info/sct"/>
<code value="24484000"/>
<display value="Severe"/>
</coding>
</severity>
<code>
<coding>
<system value="http://snomed.info/sct"/>
<code value="39065001"/>
<display value="Burn of ear"/>
</coding>
<text value="Burnt Ear"/>
</code>
<bodySite>
<coding>
<system value="http://snomed.info/sct"/>
<code value="49521004"/>
<display value="Left external ear structure"/>
</coding>
<text value="Left Ear"/>
</bodySite>
<subject>
<reference value="Patient/example"/>
</subject>
<onsetDateTime value="2012-05-24"/>
</Condition>

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
*.out

View File

@ -1,64 +0,0 @@
map "http://hl7.org/fhir/StructureMap/ActivityDefinition3to4" = "R3 to R4 Conversions for ActivityDefinition"
uses "http://hl7.org/fhir/3.0/StructureDefinition/ActivityDefinition" alias ActivityDefinitionR3 as source
uses "http://hl7.org/fhir/StructureDefinition/ActivityDefinition" alias ActivityDefinition as target
imports "http://hl7.org/fhir/StructureMap/*3to4"
group ActivityDefinition(source src : ActivityDefinitionR3, target tgt : ActivityDefinition) extends DomainResource <<type+>> {
src.url -> tgt.url;
src.identifier -> tgt.identifier;
src.version -> tgt.version;
src.name -> tgt.name;
src.title -> tgt.title;
src.subtitle -> tgt.subtitle;
src.status -> tgt.status;
src.experimental -> tgt.experimental;
src.subject -> tgt.subject;
src.date -> tgt.date;
src.publisher -> tgt.publisher;
src.contact -> tgt.contact;
src.description -> tgt.description;
src.useContext -> tgt.useContext;
src.jurisdiction -> tgt.jurisdiction;
src.purpose -> tgt.purpose;
src.usage -> tgt.usage;
src.copyright -> tgt.copyright;
src.approvalDate -> tgt.approvalDate;
src.lastReviewDate -> tgt.lastReviewDate;
src.effectivePeriod -> tgt.effectivePeriod;
src.topic -> tgt.topic;
src.contributor as vs where type = 'author' -> tgt.author as vt then Contributor(vs, vt);
src.contributor as vs where type = 'editor' -> tgt.editor as vt then Contributor(vs, vt);
src.contributor as vs where type = 'reviewer' -> tgt.reviewer as vt then Contributor(vs, vt);
src.contributor as vs where type = 'endorser' -> tgt.endorser as vt then Contributor(vs, vt);
src.relatedArtifact -> tgt.relatedArtifact;
src.library -> tgt.library;
src.kind as v -> tgt.kind = translate(v, 'http://hl7.org/fhir/StructureMap/ConceptMaps3to4#ResourceTypeMap', 'code');
src.code -> tgt.code;
src.doNotPerform -> tgt.doNotPerform;
src.timing -> tgt.timing;
src.location -> tgt.location;
src.participant as s -> tgt.participant as t then ActivityDefinitionParticipant(s, t);
src.product -> tgt.product;
src.quantity -> tgt.quantity;
src.dosage -> tgt.dosage;
src.bodySite -> tgt.bodySite;
src.specimenRequirement -> tgt.specimenRequirement;
src.transform -> tgt.transform;
src.dynamicValue as s -> tgt.dynamicValue as t then ActivityDefinitionDynamicValue(s, t);
}
group ActivityDefinitionParticipant(source src, target tgt) extends BackboneElement {
src.type -> tgt.type;
src.role -> tgt.role;
}
group ActivityDefinitionDynamicValue(source src, target tgt) extends BackboneElement {
src.path -> tgt.path;
src as vs where vs.type.exists().not() -> tgt.expression = create('Expression') as vt then {
vs.description -> vt.description;
vs.language -> vt.language;
vs.expression -> vt.expression;
} "expression";
}

View File

@ -1,6 +0,0 @@
<fml-tests>
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patassignment" source="qr.json" map="qr2pat-assignment.map" output="qr2pat-assignment-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patgender" source="qr.json" map="qr2pat-gender.map" output="qr2pat-gender-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannametwice" source="qr.json" map="qr2pat-humannametwice.map" output="qr2pat-humannametwice-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannameshared" source="qr.json" map="qr2pat-humannameshared.map" output="qr2pat-humannameshared-res.json" />
</fml-tests>

View File

@ -1,39 +0,0 @@
{
"resourceType": "QuestionnaireResponse",
"status": "in-progress",
"item": [
{
"linkId": "patient",
"text": "Patient",
"item": [
{
"linkId": "patient.lastname",
"text": "Name",
"answer": [
{
"valueString": "Brönnimann-Bertholet"
}
]
},
{
"linkId": "patient.firstname",
"text": "Vorname",
"answer": [
{
"valueString": "Elisabeth"
}
]
},
{
"linkId": "patient.sex",
"text": "Geschlecht",
"answer": [
{
"valueString": "female"
}
]
}
]
}
]
}

View File

@ -1,4 +0,0 @@
{
"resourceType" : "Patient",
"gender" : "female"
}

View File

@ -1,8 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patassignment" = "qr2patassignment"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src -> tgt.gender = 'female' "Simple Assignment";
}

View File

@ -1,4 +0,0 @@
{
"resourceType" : "Patient",
"gender" : "female"
}

View File

@ -1,12 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patgender" = "qr2patgender"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item -> tgt as patient then item(item, patient);
}
group item(source src, target tgt: Patient) {
src.item as item where linkId.value in ('patient.sex') -> tgt.gender = (item.answer.valueString);
}

View File

@ -1,8 +0,0 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet",
"given" : ["Elisabeth"]
}],
"gender" : "female"
}

View File

@ -1,26 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannameshared" = "qr2pathumannametwice"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group entry(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item then item(item, tgt);
}
group item(source src, target tgt) {
src.item as item then item(item, tgt);
src.item as item where linkId.value = 'patient.lastname' -> tgt.name as name share patientName then humanNameFamily(item, name);
src.item as item where linkId.value = 'patient.firstname' -> tgt.name as name share patientName then humanNameGiven(item, name);
src.item as item where linkId.value = 'patient.sex' -> tgt.gender = (item.answer.valueString);
}
group humanNameFamily(source src, target tgt: HumanName) {
src.answer as answer -> tgt.family = (answer.valueString);
}
group humanNameGiven(source src, target tgt: HumanName) {
src.answer as answer -> tgt.given = (answer.valueString);
}
group administrativeGender(source src, target tgt: code) {
src.answer as answer -> tgt = (answer.valueString);
}

View File

@ -1,10 +0,0 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet"
},
{
"given" : ["Elisabeth"]
}],
"gender" : "female"
}

View File

@ -1,26 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannametwice" = "qr2pathumannametwice"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group entry(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item then item(item, tgt);
}
group item(source src, target tgt) {
src.item as item then item(item, tgt);
src.item as item where linkId.value = 'patient.lastname' -> tgt.name as name then humanNameFamily(item, name);
src.item as item where linkId.value = 'patient.firstname' -> tgt.name as name then humanNameGiven(item, name);
src.item as item where linkId.value = 'patient.sex' -> tgt.gender = (item.answer.valueString);
}
group humanNameFamily(source src, target tgt: HumanName) {
src.answer as answer -> tgt.family = (answer.valueString);
}
group humanNameGiven(source src, target tgt: HumanName) {
src.answer as answer -> tgt.given = (answer.valueString);
}
group administrativeGender(source src, target tgt: code) {
src.answer as answer -> tgt = (answer.valueString);
}

View File

@ -1,16 +0,0 @@
{
"identifier":[{
"system":"urn:oid:1.2.36.146.595.217.0.1",
"value":"12345"
}],
"active":true,
"name":[{
"given":["Peter","James"],
"family":"Chalmers"
},{
"given":["Jim"]
},{
"given":["Peter","James"],
"family":"Windsor"
}]
}

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeSystem xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<h2/>
<p>This code system null defines the following codes:</p>
<table class="codes">
<tr>
<td style="white-space:nowrap">
<b>Code</b>
</td>
<td>
<b>Display</b>
</td>
<td>
<b>Definition</b>
</td>
</tr>
<tr>
<td style="white-space:nowrap">125901
<a name="null-125901"> </a>
</td>
<td>CARDIOsphere</td>
<td>CARDIOsphere&#x99; ultrasonic contrast agent produced by POINT Biomedical</td>
</tr>
</table>
</div>
</text>
<status value="active"/>
<caseSensitive value="true"/>
<content value="complete"/>
<concept>
<code value="125901"/>
<display value="CARDIOsphere"/>
<definition value="CARDIOsphere&#x99; ultrasonic contrast agent produced by POINT Biomedical"/>
</concept>
</CodeSystem>

View File

@ -1,18 +0,0 @@
Patient(http://hl7.org/fhir/us/core/Patient) {
managingOrganization cardinality 0..1 'description of item' :
Organization(http://hl7.org/fhir/us/core/Organization) {
endpoint : Endpoint
};
Basic;
Group {
item : Patient
},
generalPractitioner : Organization,
search Observation?patient={ref} cardinality 0..10 'Observations for the patient' {
performer : Practitioner,
related.where(type='has-member').target : Observation require matching Patient,
related.where(type='derived-from').target : Observation where identical Patient,
related.where(type='sequel-to').target : Observation where different Patient,
related.where(type='qualified-by').target : Observation where custom Patient = path
}
}

View File

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bundle xmlns="http://hl7.org/fhir">
<entry>
<fullUrl value="http://hl7.org/fhir/test/Patient/example"/>
<resource>
<Patient>
<id value="example"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<table>
<tbody>
<tr>
<td>Name</td>
<td>Peter James
<b>Chalmers</b>("Jim") </td> </tr>
<tr>
<td>Address</td>
<td>534 Erewhon, Pleasantville, Vic, 3999</td> </tr>
<tr>
<td>Contacts</td>
<td>Home: unknown. Work: (03) 5555 6473</td> </tr>
<tr>
<td>Id</td>
<td>MRN: 12345 (Acme Healthcare)</td> </tr> </tbody> </table> </div>
</text>
<!--MRN assigned by ACME healthcare on 6-May 2001-->
<identifier>
<use value="usual"/>
<type>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v2-0203"/>
<code value="MR"/>
</coding>
</type>
<system value="urn:oid:1.2.36.146.595.217.0.1"/>
<value value="12345"/>
<period>
<start value="2001-05-06"/>
</period>
<assigner>
<display value="Acme Healthcare"/>
</assigner>
</identifier>
<active value="true"/>
<!--Peter James Chalmers, but called "Jim"-->
<name>
<use value="official"/>
<family value="Chalmers"/>
<given value="Peter"/>
<given value="James"/>
</name>
<name>
<use value="usual"/>
<given value="Jim"/>
</name>
<name>
<!--Maiden names apply for anyone whose name changes as a result of marriage - irrespective of gender-->
<use value="maiden"/>
<family value="Windsor"/>
<given value="Peter"/>
<given value="James"/>
<period>
<end value="2002"/>
</period>
</name>
<telecom>
<use value="home"/>
<!--home communication details aren't known-->
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 5555 6473"/>
<use value="work"/>
<rank value="1"/>
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 3410 5613"/>
<use value="mobile"/>
<rank value="2"/>
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 5555 8834"/>
<use value="old"/>
<period>
<end value="2014"/>
</period>
</telecom>
<!--use FHIR code system for male / female-->
<gender value="male"/>
<birthDate value="1974-12-25">
<extension url="http://hl7.org/fhir/StructureDefinition/patient-birthTime">
<valueDateTime value="1974-12-25T14:35:45-05:00"/>
</extension>
</birthDate>
<deceasedBoolean value="false"/>
<address>
<use value="home"/>
<type value="both"/>
<text value="534 Erewhon St PeasantVille, Rainbow, Vic 3999"/>
<line value="534 Erewhon St"/>
<city value="PleasantVille"/>
<district value="Rainbow"/>
<state value="Vic"/>
<postalCode value="3999"/>
<period>
<start value="1974-12-25"/>
</period>
</address>
<contact>
<relationship>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v2-0131"/>
<code value="N"/>
</coding>
</relationship>
<name>
<family value="du March&#233;">
<!--the "du" part is a family name prefix (VV in iso 21090)-->
<extension url="http://hl7.org/fhir/StructureDefinition/humanname-own-prefix">
<valueString value="VV"/>
</extension>
</family>
<given value="B&#233;n&#233;dicte"/>
</name>
<telecom>
<system value="phone"/>
<value value="+33 (237) 998327"/>
</telecom>
<address>
<use value="home"/>
<type value="both"/>
<line value="534 Erewhon St"/>
<city value="PleasantVille"/>
<district value="Rainbow"/>
<state value="Vic"/>
<postalCode value="3999"/>
<period>
<start value="1974-12-25"/>
</period>
</address>
<gender value="female"/>
<period>
<!--The contact relationship started in 2012-->
<start value="2012"/>
</period>
</contact>
<managingOrganization>
<reference value="Organization/1"/>
</managingOrganization>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="http://hl7.org/fhir/test/Organization/1"/>
<resource>
<Organization>
<id value="1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Gastroenterology @ Acme Hospital. ph: +1 555 234 3523, email:
<a href="mailto:gastro@acme.org">gastro@acme.org</a> </p> </div>
</text>
<!--Clinical Team "Gastroenterology" at Acme Hospital-->
<identifier>
<system value="http://www.acme.org.au/units"/>
<value value="Gastro"/>
</identifier>
<name value="Gastroenterology"/>
<telecom>
<system value="phone"/>
<value value="+1 555 234 3523"/>
<use value="mobile"/>
</telecom>
<telecom>
<system value="email"/>
<value value="gastro@acme.org"/>
<use value="work"/>
</telecom>
</Organization>
</resource>
</entry>
</Bundle>

View File

@ -1,9 +0,0 @@
<graphdef-tests>
<test name="simple" source="simple.gdl" context="Patient/example/$graph">
<rule description="Must be 2 resources in the bundle" expression="Bundle.entry.count() = 2"/>
</test>
<test name="full-syntax" source="full-syntax.gdl" context="Patient/example/$graph">
<rule description="Must be 2 resources in the bundle" expression="Bundle.entry.count() = 2"/>
</test>
</graphdef-tests>

View File

@ -1 +0,0 @@
Patient{managingOrganization:Organization{endpoint:Endpoint}}

View File

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bundle xmlns="http://hl7.org/fhir">
<entry>
<fullUrl value="http://hl7.org/fhir/test/Patient/example"/>
<resource>
<Patient>
<id value="example"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<table>
<tbody>
<tr>
<td>Name</td>
<td>Peter James
<b>Chalmers</b>("Jim") </td> </tr>
<tr>
<td>Address</td>
<td>534 Erewhon, Pleasantville, Vic, 3999</td> </tr>
<tr>
<td>Contacts</td>
<td>Home: unknown. Work: (03) 5555 6473</td> </tr>
<tr>
<td>Id</td>
<td>MRN: 12345 (Acme Healthcare)</td> </tr> </tbody> </table> </div>
</text>
<!--MRN assigned by ACME healthcare on 6-May 2001-->
<identifier>
<use value="usual"/>
<type>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v2-0203"/>
<code value="MR"/>
</coding>
</type>
<system value="urn:oid:1.2.36.146.595.217.0.1"/>
<value value="12345"/>
<period>
<start value="2001-05-06"/>
</period>
<assigner>
<display value="Acme Healthcare"/>
</assigner>
</identifier>
<active value="true"/>
<!--Peter James Chalmers, but called "Jim"-->
<name>
<use value="official"/>
<family value="Chalmers"/>
<given value="Peter"/>
<given value="James"/>
</name>
<name>
<use value="usual"/>
<given value="Jim"/>
</name>
<name>
<!--Maiden names apply for anyone whose name changes as a result of marriage - irrespective of gender-->
<use value="maiden"/>
<family value="Windsor"/>
<given value="Peter"/>
<given value="James"/>
<period>
<end value="2002"/>
</period>
</name>
<telecom>
<use value="home"/>
<!--home communication details aren't known-->
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 5555 6473"/>
<use value="work"/>
<rank value="1"/>
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 3410 5613"/>
<use value="mobile"/>
<rank value="2"/>
</telecom>
<telecom>
<system value="phone"/>
<value value="(03) 5555 8834"/>
<use value="old"/>
<period>
<end value="2014"/>
</period>
</telecom>
<!--use FHIR code system for male / female-->
<gender value="male"/>
<birthDate value="1974-12-25">
<extension url="http://hl7.org/fhir/StructureDefinition/patient-birthTime">
<valueDateTime value="1974-12-25T14:35:45-05:00"/>
</extension>
</birthDate>
<deceasedBoolean value="false"/>
<address>
<use value="home"/>
<type value="both"/>
<text value="534 Erewhon St PeasantVille, Rainbow, Vic 3999"/>
<line value="534 Erewhon St"/>
<city value="PleasantVille"/>
<district value="Rainbow"/>
<state value="Vic"/>
<postalCode value="3999"/>
<period>
<start value="1974-12-25"/>
</period>
</address>
<contact>
<relationship>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/v2-0131"/>
<code value="N"/>
</coding>
</relationship>
<name>
<family value="du March&#233;">
<!--the "du" part is a family name prefix (VV in iso 21090)-->
<extension url="http://hl7.org/fhir/StructureDefinition/humanname-own-prefix">
<valueString value="VV"/>
</extension>
</family>
<given value="B&#233;n&#233;dicte"/>
</name>
<telecom>
<system value="phone"/>
<value value="+33 (237) 998327"/>
</telecom>
<address>
<use value="home"/>
<type value="both"/>
<line value="534 Erewhon St"/>
<city value="PleasantVille"/>
<district value="Rainbow"/>
<state value="Vic"/>
<postalCode value="3999"/>
<period>
<start value="1974-12-25"/>
</period>
</address>
<gender value="female"/>
<period>
<!--The contact relationship started in 2012-->
<start value="2012"/>
</period>
</contact>
<managingOrganization>
<reference value="Organization/1"/>
</managingOrganization>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="http://hl7.org/fhir/test/Organization/1"/>
<resource>
<Organization>
<id value="1"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Gastroenterology @ Acme Hospital. ph: +1 555 234 3523, email:
<a href="mailto:gastro@acme.org">gastro@acme.org</a> </p> </div>
</text>
<!--Clinical Team "Gastroenterology" at Acme Hospital-->
<identifier>
<system value="http://www.acme.org.au/units"/>
<value value="Gastro"/>
</identifier>
<name value="Gastroenterology"/>
<telecom>
<system value="phone"/>
<value value="+1 555 234 3523"/>
<use value="mobile"/>
</telecom>
<telecom>
<system value="email"/>
<value value="gastro@acme.org"/>
<use value="work"/>
</telecom>
</Organization>
</resource>
</entry>
</Bundle>

View File

@ -1,5 +0,0 @@
{
identifier @include(if: true) { system value }
active
name { text given family }
}

View File

@ -1,16 +0,0 @@
{
"identifier": [{
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}],
"active": true,
"name": [{
"given": ["Peter","James"],
"family": "Chalmers"
},{
"given": ["Jim"]
},{
"given": ["Peter","James"],
"family": "Windsor"
}]
}

View File

@ -1,5 +0,0 @@
{
identifier @skip(if: true) { system value }
active
name { text given family }
}

View File

@ -1,12 +0,0 @@
{
"active": true,
"name": [{
"given": ["Peter","James"],
"family": "Chalmers"
},{
"given": ["Jim"]
},{
"given": ["Peter","James"],
"family": "Windsor"
}]
}

View File

@ -1,5 +0,0 @@
query test($var : Boolean) {
identifier @include(if: $var) { system value }
active
name { text given family }
}

View File

@ -1,16 +0,0 @@
{
"identifier": [{
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}],
"active": true,
"name": [{
"given": ["Peter","James"],
"family": "Chalmers"
},{
"given": ["Jim"]
},{
"given": ["Peter","James"],
"family": "Windsor"
}]
}

View File

@ -1,4 +0,0 @@
{
id
extension(url : "http://example.org/StructureDefinition/trials") { url, valueCode }
}

View File

@ -1,9 +0,0 @@
{
"id": "glossy",
"extension": [
{
"url": "http://example.org/StructureDefinition/trials",
"valueCode": "renal"
}
]
}

View File

@ -1,4 +0,0 @@
{
id
extension(url : "http://example.org/StructureDefinition/trialsX") { url, valueCode }
}

View File

@ -1,3 +0,0 @@
{
"id": "glossy"
}

View File

@ -1,4 +0,0 @@
{
id
extension { url, valueCode }
}

View File

@ -1,9 +0,0 @@
{
"id": "glossy",
"extension": [
{
"url": "http://example.org/StructureDefinition/trials",
"valueCode": "renal"
}
]
}

View File

@ -1,4 +0,0 @@
{
subject { resource { birthDate } }
subject { resource { _birthDate { extension {valueDateTime} } } }
}

View File

@ -1,15 +0,0 @@
{
"subject": [{
"resource": {
"birthDate": "2016-05-18"
}
},{
"resource": {
"_birthDate": {
"extension":[{
"valueDateTime": "2016-05-18T10:28:45Z"
}]
}
}
}]
}

View File

@ -1,5 +0,0 @@
{
identifier { system value }
active
name(fhirpath: "family.exists()") { text given family }
}

View File

@ -1,14 +0,0 @@
{
"identifier": [{
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}],
"active": true,
"name": [{
"given": ["Peter","James"],
"family": "Chalmers"
},{
"given":["Peter","James"],
"family":"Windsor"
}]
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system value }
active
name @flatten { text given @first family }
}

View File

@ -1,7 +0,0 @@
{
"system":["urn:oid:1.2.36.146.595.217.0.1"],
"value":["12345"],
"active":true,
"given":["Peter","Jim","Peter"],
"family":["Chalmers","Windsor"]
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system @singleton value @singleton }
active
name @flatten { text given family }
}

View File

@ -1,7 +0,0 @@
{
"system":"urn:oid:1.2.36.146.595.217.0.1",
"value":"12345",
"active":true,
"given":["Peter","James","Jim","Peter","James"],
"family":["Chalmers","Windsor"]
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system @singleton value @singleton }
active
name @flatten { text given family @singleton }
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system @singleton value @singleton }
active
name @flatten @first { text given family @singleton }
}

View File

@ -1,7 +0,0 @@
{
"system":"urn:oid:1.2.36.146.595.217.0.1",
"value":"12345",
"active":true,
"given":["Peter","James"],
"family":"Chalmers"
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system value }
active
name @flatten @slice(path: "use") { given family @singleton }
}

View File

@ -1,10 +0,0 @@
{
"system":["urn:oid:1.2.36.146.595.217.0.1"],
"value":["12345"],
"active":true,
"given.official":["Peter","James"],
"family.official":"Chalmers",
"given.usual":["Jim"],
"given.maiden":["Peter","James"],
"family.maiden":"Windsor"
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system value }
active
name @flatten @slice(path: "$index") { given family @singleton }
}

View File

@ -1,10 +0,0 @@
{
"system":["urn:oid:1.2.36.146.595.217.0.1"],
"value":["12345"],
"active":true,
"given.0":["Peter","James"],
"family.0":"Chalmers",
"given.1":["Jim"],
"given.2":["Peter","James"],
"family.2":"Windsor"
}

View File

@ -1,5 +0,0 @@
{
identifier @flatten { system value }
active
name @flatten { text given family }
}

View File

@ -1,7 +0,0 @@
{
"system":["urn:oid:1.2.36.146.595.217.0.1"],
"value":["12345"],
"active":true,
"given":["Peter","James","Jim","Peter","James"],
"family":["Chalmers","Windsor"]
}

View File

@ -1,3 +0,0 @@
{
entry(_count: 5, _offset: 5) { deleted item { reference } }
}

View File

@ -1,29 +0,0 @@
{
"entry": [
{
"item": {
"reference": "Patient/1"
}
},
{
"item": {
"reference": "Patient/2"
}
},
{
"item": {
"reference": "Patient/3"
}
},
{
"item": {
"reference": "Patient/4"
}
},
{
"item": {
"reference": "Patient/5"
}
}
]
}

View File

@ -1,31 +0,0 @@
<graphql-tests>
<test name="simple" source="simple.gql" output="simple.json" context="Patient/example/$graphql"/>
<test name="filter-fhirpath" source="filter-fhirpath.gql" output="filter-fhirpath.json" context="Patient/example/$graphql"/>
<test name="using wrong field" source="wrong-field.gql" output="$error" context="Patient/example/$graphql"/>
<test name="polymorphic" source="polymorphic.gql" output="polymorphic.json" context="Observation/example/$graphql"/>
<test name="reference" source="reference.gql" output="reference.json" context="Observation/example/$graphql"/>
<test name="reference-type-in" source="reference-type-in.gql" output="reference-type-in.json" context="Observation/example/$graphql"/>
<test name="reference-type-out" source="reference-type-out.gql" output="reference-type-out.json" context="Observation/example/$graphql"/>
<test name="reference-broken" source="reference-broken.gql" output="$error" context="MedicationDispense/meddisp008/$graphql" resource="medicationdispenseexample8"/>
<test name="reference-optional" source="reference-optional.gql" output="reference-optional.json" context="MedicationDispense/meddisp008/$graphql" resource="medicationdispenseexample8"/>
<test name="reference-fragment-type" source="reference-fragment-type.gql" output="reference-fragment-type.json" context="Observation/example/$graphql"/>
<test name="extension-complex" source="extension-complex.gql" output="extension-complex.json" context="Patient/glossy/$graphql" resource="patient-glossy-example"/>
<test name="extension-complex-in" source="extension-complex-in.gql" output="extension-complex-in.json" context="Patient/glossy/$graphql" resource="patient-glossy-example"/>
<test name="extension-complex-out" source="extension-complex-out.gql" output="extension-complex-out.json" context="Patient/glossy/$graphql" resource="patient-glossy-example"/>
<test name="extension-simple" source="extension-simple.gql" output="extension-simple.json" context="Observation/20minute-apgar-score/$graphql" resource="observation-example-20minute-apgar-score"/>
<test name="search-single" source="search-single.gql" output="search-single.json" context=""/>
<test name="search-simple" source="search-simple.gql" output="search-simple.json" context=""/>
<test name="search-full" source="search-full.gql" output="search-full.json" context=""/>
<test name="reference-reverse" source="reference-reverse.gql" output="reference-reverse.json" context="Patient/example/$graphql"/>
<test name="directive-skip" source="directive-skip.gql" output="directive-skip.json" context="Patient/example/$graphql"/>
<test name="directive-include" source="directive-include.gql" output="directive-include.json" context="Patient/example/$graphql"/>
<test name="directive-variable" source="directive-variable.gql" output="directive-variable.json" context="Patient/example/$graphql" operation="test"/>
<test name="flatten" source="flatten.gql" output="flatten.json" context="Patient/example/$graphql"/>
<test name="flatten-first" source="flatten-first.gql" output="flatten-first.json" context="Patient/example/$graphql"/>
<test name="flatten-singleton1" source="flatten-singleton1.gql" output="flatten-singleton1.json" context="Patient/example/$graphql"/>
<test name="flatten-singleton2" source="flatten-singleton2.gql" output="$error" context="Patient/example/$graphql"/>
<test name="flatten-singleton3" source="flatten-singleton3.gql" output="flatten-singleton3.json" context="Patient/example/$graphql"/>
<test name="flatten-slice1" source="flatten-slice1.gql" output="flatten-slice1.json" context="Patient/example/$graphql"/>
<test name="flatten-slice2" source="flatten-slice2.gql" output="flatten-slice2.json" context="Patient/example/$graphql"/>
<test name="list-sub" source="list-sub.gql" output="list-sub.json" context="List/example-long/$graphql"/>
</graphql-tests>

View File

@ -1,329 +0,0 @@
#### SelectionSet
{
id
firstName
lastName
}
#### Short
{
field
}
#### Simple
{
user(id: 4) {
name
}
}
#### User
# `user` represents one of many users in a graph of data, referred to by a
# unique identifier.
{
user(id: 4) {
name
}
}
#### Variable
query getZuckProfile($devicePicSize: Int) {
user(id: 4) {
id
name
profilePic(size: $devicePicSize)
}
}
#### Alias1
{
user(id: 4) {
id
name
smallPic: profilePic(size: 64)
bigPic: profilePic(size: 1024)
}
}
#### Alias2
{
zuck: user(id: 4) {
id
name
}
}
#### Arguments1
{
user(id: 4) {
id
name
profilePic(size: 100)
}
}
#### Arguments2
{
user(id: 4) {
id
name
profilePic(width: 100, height: 50)
}
}
#### Arguments3
{
picture(width: 200, height: 100)
}
#### Arguments4
{
picture(height: 100, width: 200)
}
#### Comment
{
# this
user(id: 4) {
name
}
}
#### Fragments0
query noFragments {
user(id: 4) {
friends(first: 10) {
id
name
profilePic(size: 50)
}
mutualFriends(first: 10) {
id
name
profilePic(size: 50)
}
}
}
#### Fragments1
query withFragments {
user(id: 4) {
friends(first: 10) {
...friendFields
}
mutualFriends(first: 10) {
...friendFields
}
}
}
fragment friendFields on User {
id
name
profilePic(size: 50)
}
#### Fragments2
query withNestedFragments {
user(id: 4) {
friends(first: 10) {
...friendFields
}
mutualFriends(first: 10) {
...friendFields
}
}
}
fragment friendFields on User {
id
name
...standardProfilePic
}
fragment standardProfilePic on User {
profilePic(size: 50)
}
#### Fragments3
query FragmentTyping {
profiles(handles: ["zuck", "cocacola"]) {
handle
...userFragment
...pageFragment
}
}
fragment userFragment on User {
friends {
count
}
}
fragment pageFragment on Page {
likers {
count
}
}
#### Fragments4
query inlineFragmentTyping {
profiles(handles: ["zuck", "cocacola"]) {
handle
... on User {
friends {
count
}
}
... on Page {
likers {
count
}
}
}
}
#### Fragments5
query inlineFragmentNoType($expandedInfo: Boolean) {
user(handle: "zuck") {
id
name
... @include(if: $expandedInfo) {
firstName
lastName
birthday
}
}
}
#### Me
# `me` could represent the currently logged in viewer.
{
me {
name
}
}
#### Mutation
mutation {
likeStory(storyID: 12345) {
story {
likeCount
}
}
}
#### Nested
{
me {
id
firstName
lastName
birthday {
month
day
}
friends {
name
}
}
}
#### Object1
{
nearestThing(location: { lon: 12.43, lat: -53.211 })
}
#### Object2
{
nearestThing(location: { lat: -53.211, lon: 12.43 })
}
#### EmptyParamList
{
user() {
name
}
}

View File

@ -1,5 +0,0 @@
{
subject{reference}
valueQuantity {value unit}
}

View File

@ -1,9 +0,0 @@
{
"subject" : {
"reference" : "Patient/example"
},
"valueQuantity": {
"value": 185,
"unit": "lbs"
}
}

View File

@ -1,6 +0,0 @@
{
# this is broken because the reference on the given example doesn't
# follow the normal naming pattern that the resource resolver
# knows how to resolve
authorizingPrescription { reference, resource {id} }
}

View File

@ -1,5 +0,0 @@
{
id
subject { reference, resource { ...on Patient {active} } }
code {coding {system code} }
}

View File

@ -1,24 +0,0 @@
{
"id" : "example",
"subject" : {
"reference" : "Patient/example",
"resource" : {
"active": true
}
},
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7"
},{
"system": "http://loinc.org",
"code": "3141-9"
},{
"system": "http://snomed.info/sct",
"code": "27113001"
},{
"system": "http://acme.org/devices/clinical-codes",
"code": "body-weight"
}]
}
}

View File

@ -1,6 +0,0 @@
{
# this is broken because the reference on the given example doesn't
# follow the normal naming pattern that the resource resolver
# knows how to resolve
authorizingPrescription { reference, resource(optional : true) {id} }
}

View File

@ -1,5 +0,0 @@
{
"authorizingPrescription" : [{
"reference" : "MedicationRequest/medrx0330"
}]
}

View File

@ -1,6 +0,0 @@
{
id
ConditionList(_reference: patient) {
id
}
}

View File

@ -1,6 +0,0 @@
{
"id" : "example",
"ConditionList":[{
"id":"example"
}]
}

View File

@ -1,5 +0,0 @@
{
id
subject { reference, resource(type : Patient) {active} }
code {coding {system code} }
}

View File

@ -1,24 +0,0 @@
{
"id" : "example",
"subject" : {
"reference" : "Patient/example",
"resource" : {
"active": true
}
},
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7"
},{
"system": "http://loinc.org",
"code": "3141-9"
},{
"system": "http://snomed.info/sct",
"code": "27113001"
},{
"system": "http://acme.org/devices/clinical-codes",
"code": "body-weight"
}]
}
}

View File

@ -1,5 +0,0 @@
{
id
subject { reference, resource(type : Group) {active} }
code {coding {system code} }
}

View File

@ -1,21 +0,0 @@
{
"id" : "example",
"subject" : {
"reference" : "Patient/example"
},
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7"
},{
"system": "http://loinc.org",
"code": "3141-9"
},{
"system": "http://snomed.info/sct",
"code": "27113001"
},{
"system": "http://acme.org/devices/clinical-codes",
"code": "body-weight"
}]
}
}

View File

@ -1,5 +0,0 @@
{
id
subject { reference, resource {active} }
code {coding {system code} }
}

View File

@ -1,24 +0,0 @@
{
"id" : "example",
"subject" : {
"reference" : "Patient/example",
"resource" : {
"active": true
}
},
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7"
},{
"system": "http://loinc.org",
"code": "3141-9"
},{
"system": "http://snomed.info/sct",
"code": "27113001"
},{
"system": "http://acme.org/devices/clinical-codes",
"code": "body-weight"
}]
}
}

View File

@ -1,9 +0,0 @@
{
PatientConnection (active : true) {
count offset pagesize
edges {
mode, score, resource { id, active }
}
first previous next last
}
}

View File

@ -1,21 +0,0 @@
{
"PatientConnection":{
"count":50,
"offset":0,
"pagesize":50,
"edges":[{
"resource":{
"id" : "example",
"active" : true
}
},{
"mode":"match",
"score":0.5,
"resource":{
"id":"xds",
"active":true
}
}],
"next":"77c97e03-8a6c-415f-a63d-11c80cf73f:50"
}
}

View File

@ -1,3 +0,0 @@
{
PatientList(active : true) { id, active }
}

View File

@ -1,9 +0,0 @@
{
"PatientList":[{
"id" : "example",
"active" : true
},{
"id":"xds",
"active":true
}]
}

View File

@ -1,3 +0,0 @@
{
Patient(id: example) { id, active }
}

View File

@ -1,6 +0,0 @@
{
"Patient" : {
"id" : "example",
"active" : true
}
}

View File

@ -1,81 +0,0 @@
{
"@type" : "graphql-server-tests",
"instance-tests" : {
"simple" : {
"description" : "Just a simple test of the basic graphQL engine: a simple query on a known patient (example, from the spec)",
"url" : "/Patient/example/$graphql?query={identifier{system,value}active,name{text,given,family}}",
"output" : {
"data" : {
"active" : true,
"identifier" : [
{
"system" : "urn:oid:1.2.36.146.595.217.0.1",
"value" : "12345"
}
],
"name" : [
{
"family" : "Chalmers",
"given" : [
"Peter",
"James"
]
},
{
"given" : [
"Jim"
]
},
{
"family" : "Windsor",
"given" : [
"Peter",
"James"
]
}
]
}
}
}
},
"root-tests" : {
"simple" : {
"description" : "Just a simple test of the basic graphQL engine: a simple query on a known patient (example, from the spec)",
"url" : "/$graphql?query={Patient(_id:\"example\"){identifier{system,value}active,name{text,given,family}}}",
"output" : {
"data" : {
"Patient" : {
"active" : true,
"identifier" : [
{
"system" : "urn:oid:1.2.36.146.595.217.0.1",
"value" : "12345"
}
],
"name" : [
{
"family" : "Chalmers",
"given" : [
"Peter",
"James"
]
},
{
"given" : [
"Jim"
]
},
{
"family" : "Windsor",
"given" : [
"Peter",
"James"
]
}
]
}
}
}
}
}
}

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