Add tests 1

This commit is contained in:
dotasek 2023-05-04 09:46:19 -04:00
parent f5e049cbbe
commit bf5f57cbb7
6 changed files with 893 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package org.hl7.fhir.convertors.conv30_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class CapabilityStatement30_40Test {
@Test
@DisplayName("Test r4 -> dstu3 CapabilityStatement conversion.")
public void testR4_Dstu3() throws IOException {
InputStream r4_input = this.getClass().getResourceAsStream("/capability_statement_40.json");
org.hl7.fhir.r4.model.CapabilityStatement r5_actual = (org.hl7.fhir.r4.model.CapabilityStatement) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input);
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_40.convertResource(r5_actual);
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_40_30.json");
org.hl7.fhir.dstu3.model.CapabilityStatement dstu3_actual = (org.hl7.fhir.dstu3.model.CapabilityStatement) dstu3_parser.parse(dstu3_input);
assertTrue(dstu3_actual.equalsDeep(dstu3_conv), "should be the same");
}
}

View File

@ -0,0 +1,28 @@
package org.hl7.fhir.convertors.conv30_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class CapabilityStatement30_50Test {
@Test
@DisplayName("Test r5 -> dstu3 CapabilityStatement conversion.")
public void testR5_Dstu3() throws IOException {
InputStream r5_input = this.getClass().getResourceAsStream("/capability_statement_50.json");
org.hl7.fhir.r5.model.CapabilityStatement r5_actual = (org.hl7.fhir.r5.model.CapabilityStatement) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_50.convertResource(r5_actual);
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
InputStream dstu3_input = this.getClass().getResourceAsStream("/capability_statement_50_30.json");
org.hl7.fhir.dstu3.model.CapabilityStatement dstu3_actual = (org.hl7.fhir.dstu3.model.CapabilityStatement) dstu3_parser.parse(dstu3_input);
assertTrue(dstu3_actual.equalsDeep(dstu3_conv), "should be the same");
}
}

View File

@ -0,0 +1,204 @@
{
"resourceType": "CapabilityStatement",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<p>The EHR Server supports the following transactions for the resource Person: read, vread, update, history, search(name,gender), create and updates.</p>\n\t\t\t<p>The EHR System supports the following message: admin-notify::Person.</p>\n\t\t\t<p>The EHR Application has a <a href=\"http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796\">general document profile</a>.\n </p>\n\t\t</div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
"valueCode": "both"
}
],
"url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311",
"version": "20130510",
"name": "ACMEEHR",
"title": "ACME EHR capability statement",
"status": "draft",
"experimental": true,
"date": "2012-01-04",
"publisher": "ACME Corporation",
"contact": [
{
"name": "System Administrator",
"telecom": [
{
"system": "email",
"value": "wile@acme.org"
}
]
}
],
"description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface",
"useContext": [
{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/variant-state",
"code": "positive"
}
]
}
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US",
"display": "United States of America (the)"
}
]
}
],
"purpose": "Main EHR capability statement, published for contracting and operational support",
"copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems",
"kind": "instance",
"instantiates": [
"http://ihe.org/fhir/CapabilityStatement/pixm-client"
],
"software": {
"name": "EHR",
"version": "0.00.020.2134",
"releaseDate": "2012-01-04"
},
"implementation": {
"description": "main EHR at ACME",
"url": "http://10.2.3.4/fhir"
},
"fhirVersion": "4.0.1",
"format": [
"xml",
"json"
],
"patchFormat": [
"application/xml-patch+xml",
"application/json-patch+json"
],
"implementationGuide": [
"http://hl7.org/fhir/us/lab"
],
"rest": [
{
"mode": "server",
"documentation": "Main FHIR endpoint for acem health",
"security": {
"cors": true,
"service": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/restful-security-service",
"code": "SMART-on-FHIR"
}
]
}
],
"description": "See Smart on FHIR documentation"
},
"resource": [
{
"type": "Patient",
"profile": "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416",
"supportedProfile": [
"http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347"
],
"documentation": "This server does not let the clients create identities.",
"interaction": [
{
"code": "read"
},
{
"code": "vread",
"documentation": "Only supported for patient records since 12-Dec 2012"
},
{
"code": "update"
},
{
"code": "history-instance"
},
{
"code": "create"
},
{
"code": "history-type"
}
],
"versioning": "versioned-update",
"readHistory": true,
"updateCreate": false,
"conditionalCreate": true,
"conditionalRead": "full-support",
"conditionalUpdate": false,
"conditionalDelete": "not-supported",
"searchInclude": [
"Organization"
],
"searchRevInclude": [
"Person"
],
"searchParam": [
{
"name": "identifier",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier",
"type": "token",
"documentation": "Only supports search by institution MRN"
},
{
"name": "general-practitioner",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner",
"type": "reference"
}
]
}
],
"interaction": [
{
"code": "transaction"
},
{
"code": "history-system"
}
],
"compartment": [
"http://hl7.org/fhir/CompartmentDefinition/patient"
]
}
],
"messaging": [
{
"endpoint": [
{
"protocol": {
"system": "http://terminology.hl7.org/CodeSystem/message-transport",
"code": "mllp"
},
"address": "mllp:10.1.1.10:9234"
}
],
"reliableCache": 30,
"documentation": "ADT A08 equivalent for external system notifications",
"supportedMessage": [
{
"mode": "receiver",
"definition": "http://hl7.org/fhir/MessageDefinition/example"
}
]
}
],
"document": [
{
"mode": "consumer",
"documentation": "Basic rules for all documents in the EHR system",
"profile": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
}
]
}

View File

@ -0,0 +1,207 @@
{
"resourceType": "CapabilityStatement",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<p>The EHR Server supports the following transactions for the resource Person: read, vread, update, history, search(name,gender), create and updates.</p>\n\t\t\t<p>The EHR System supports the following message: admin-notify::Person.</p>\n\t\t\t<p>The EHR Application has a <a href=\"http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796\">general document profile</a>.\n </p>\n\t\t</div>"
},
"url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311",
"version": "20130510",
"name": "ACMEEHR",
"title": "ACME EHR capability statement",
"status": "draft",
"experimental": true,
"date": "2012-01-04",
"publisher": "ACME Corporation",
"contact": [
{
"name": "System Administrator",
"telecom": [
{
"system": "email",
"value": "wile@acme.org"
}
]
}
],
"description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface",
"useContext": [
{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/variant-state",
"code": "positive"
}
]
}
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US",
"display": "United States of America (the)"
}
]
}
],
"purpose": "Main EHR capability statement, published for contracting and operational support",
"copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems",
"kind": "instance",
"instantiates": [
"http://ihe.org/fhir/CapabilityStatement/pixm-client"
],
"software": {
"name": "EHR",
"version": "0.00.020.2134",
"releaseDate": "2012-01-04"
},
"implementation": {
"description": "main EHR at ACME",
"url": "http://10.2.3.4/fhir"
},
"fhirVersion": "4.0.1",
"acceptUnknown": "both",
"format": [
"xml",
"json"
],
"patchFormat": [
"application/xml-patch+xml",
"application/json-patch+json"
],
"implementationGuide": [
"http://hl7.org/fhir/us/lab"
],
"profile": [
{
"reference": "http://registry.fhir.org/r4/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347"
}
],
"rest": [
{
"mode": "server",
"documentation": "Main FHIR endpoint for acem health",
"security": {
"cors": true,
"service": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/restful-security-service",
"code": "SMART-on-FHIR"
}
]
}
],
"description": "See Smart on FHIR documentation"
},
"resource": [
{
"type": "Patient",
"profile": {
"reference": "http://registry.fhir.org/r4/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416"
},
"documentation": "This server does not let the clients create identities.",
"interaction": [
{
"code": "read"
},
{
"code": "vread",
"documentation": "Only supported for patient records since 12-Dec 2012"
},
{
"code": "update"
},
{
"code": "history-instance"
},
{
"code": "create"
},
{
"code": "history-type"
}
],
"versioning": "versioned-update",
"readHistory": true,
"updateCreate": false,
"conditionalCreate": true,
"conditionalRead": "full-support",
"conditionalUpdate": false,
"conditionalDelete": "not-supported",
"searchInclude": [
"Organization"
],
"searchRevInclude": [
"Person"
],
"searchParam": [
{
"name": "identifier",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier",
"type": "token",
"documentation": "Only supports search by institution MRN"
},
{
"name": "general-practitioner",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner",
"type": "reference"
}
]
}
],
"interaction": [
{
"code": "transaction"
},
{
"code": "history-system"
}
],
"compartment": [
"http://hl7.org/fhir/CompartmentDefinition/patient"
]
}
],
"messaging": [
{
"endpoint": [
{
"protocol": {
"system": "http://terminology.hl7.org/CodeSystem/message-transport",
"code": "mllp"
},
"address": "mllp:10.1.1.10:9234"
}
],
"reliableCache": 30,
"documentation": "ADT A08 equivalent for external system notifications",
"supportedMessage": [
{
"mode": "receiver",
"definition": {
"reference": "http://hl7.org/fhir/MessageDefinition/example"
}
}
]
}
],
"document": [
{
"mode": "consumer",
"documentation": "Basic rules for all documents in the EHR system",
"profile": {
"reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
}
}
]
}

View File

@ -0,0 +1,215 @@
{
"resourceType": "CapabilityStatement",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<p>The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.</p>\n\t\t\t\n <p>The EHR System supports the following message: admin-notify::Person.</p>\n\t\t\t\n <p>The EHR Application has a \n \n <a href=\"http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796\">general document profile</a>.\n \n </p>\n\t\t\n </div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
"valueCode": "both"
},
{
"url": "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile",
"valueReference": {
"reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic"
}
}
],
"url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311",
"version": "20130510",
"name": "ACMEEHR",
"title": "ACME EHR capability statement",
"status": "draft",
"experimental": true,
"date": "2012-01-04",
"publisher": "ACME Corporation",
"contact": [
{
"name": "System Administrator",
"telecom": [
{
"system": "email",
"value": "wile@acme.org"
}
]
}
],
"description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface",
"useContext": [
{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/variant-state",
"code": "positive"
}
]
}
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US",
"display": "United States of America (the)"
}
]
}
],
"purpose": "Main EHR capability statement, published for contracting and operational support",
"copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems",
"kind": "instance",
"instantiates": [
"http://ihe.org/fhir/CapabilityStatement/pixm-client"
],
"software": {
"name": "EHR",
"version": "0.00.020.2134",
"releaseDate": "2012-01-04"
},
"implementation": {
"description": "main EHR at ACME",
"url": "http://10.2.3.4/fhir"
},
"fhirVersion": "5.0.0",
"format": [
"xml",
"json"
],
"patchFormat": [
"application/xml-patch+xml",
"application/json-patch+json"
],
"acceptLanguage": [
"en",
"es"
],
"implementationGuide": [
"http://example.org/fhir/us/lab"
],
"rest": [
{
"mode": "server",
"documentation": "Main FHIR endpoint for acem health",
"security": {
"cors": true,
"service": [
{
"coding": [
{
"system": "http://hl7.org/fhir/restful-security-service",
"code": "SMART-on-FHIR"
}
]
}
],
"description": "See Smart on FHIR documentation"
},
"resource": [
{
"type": "Patient",
"profile": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416",
"supportedProfile": [
"http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347"
],
"documentation": "This server does not let the clients create identities.",
"interaction": [
{
"code": "read"
},
{
"code": "vread",
"documentation": "Only supported for patient records since 12-Dec 2012"
},
{
"code": "update"
},
{
"code": "history-instance"
},
{
"code": "create"
},
{
"code": "history-type"
}
],
"versioning": "versioned-update",
"readHistory": true,
"updateCreate": false,
"conditionalCreate": true,
"conditionalRead": "full-support",
"conditionalUpdate": false,
"conditionalPatch": false,
"conditionalDelete": "not-supported",
"searchInclude": [
"Patient:organization"
],
"searchRevInclude": [
"Person:patient"
],
"searchParam": [
{
"name": "identifier",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier",
"type": "token",
"documentation": "Only supports search by institution MRN"
},
{
"name": "general-practitioner",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner",
"type": "reference"
}
]
}
],
"interaction": [
{
"code": "transaction"
},
{
"code": "history-system"
}
],
"compartment": [
"http://hl7.org/fhir/CompartmentDefinition/patient"
]
}
],
"messaging": [
{
"endpoint": [
{
"protocol": {
"system": "http://hl7.org/fhir/message-transport",
"code": "mllp"
},
"address": "mllp:10.1.1.10:9234"
}
],
"reliableCache": 30,
"documentation": "ADT A08 equivalent for external system notifications",
"supportedMessage": [
{
"mode": "receiver",
"definition": "http://hl7.org/fhir/MessageDefinition/example"
}
]
}
],
"document": [
{
"mode": "consumer",
"documentation": "Basic rules for all documents in the EHR system",
"profile": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
}
]
}

View File

@ -0,0 +1,210 @@
{
"resourceType": "CapabilityStatement",
"id": "example",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<p>The EHR Server supports the following transactions for the resource Person: read, vread, \n update, history, search(name,gender), create and updates.</p>\n\t\t\t\n <p>The EHR System supports the following message: admin-notify::Person.</p>\n\t\t\t\n <p>The EHR Application has a \n \n <a href=\"http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796\">general document profile</a>.\n \n </p>\n\t\t\n </div>"
},
"url": "urn:uuid:68d043b5-9ecf-4559-a57a-396e0d452311",
"version": "20130510",
"name": "ACMEEHR",
"title": "ACME EHR capability statement",
"status": "draft",
"experimental": true,
"date": "2012-01-04",
"publisher": "ACME Corporation",
"contact": [
{
"name": "System Administrator",
"telecom": [
{
"system": "email",
"value": "wile@acme.org"
}
]
}
],
"description": "This is the FHIR capability statement for the main EHR at ACME for the private interface - it does not describe the public interface",
"useContext": [
{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/variant-state",
"code": "positive"
}
]
}
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US",
"display": "United States of America (the)"
}
]
}
],
"purpose": "Main EHR capability statement, published for contracting and operational support",
"copyright": "Copyright © Acme Healthcare and GoodCorp EHR Systems",
"kind": "instance",
"instantiates": [
"http://ihe.org/fhir/CapabilityStatement/pixm-client"
],
"software": {
"name": "EHR",
"version": "0.00.020.2134",
"releaseDate": "2012-01-04"
},
"implementation": {
"description": "main EHR at ACME",
"url": "http://10.2.3.4/fhir"
},
"fhirVersion": "5.0.0",
"acceptUnknown": "both",
"format": [
"xml",
"json"
],
"patchFormat": [
"application/xml-patch+xml",
"application/json-patch+json"
],
"implementationGuide": [
"http://example.org/fhir/us/lab"
],
"profile": [
{
"reference": "http://registry.fhir.org/r5/StructureDefinition/00ab9e7a-06c7-4f77-9234-4154ca1e3347"
},
{
"reference": "http://hl7.org/fhir/us/core/StructureDefinition/familymemberhistory-genetic"
}
],
"rest": [
{
"mode": "server",
"documentation": "Main FHIR endpoint for acem health",
"security": {
"cors": true,
"service": [
{
"coding": [
{
"system": "http://hl7.org/fhir/restful-security-service",
"code": "SMART-on-FHIR"
}
]
}
],
"description": "See Smart on FHIR documentation"
},
"resource": [
{
"type": "Patient",
"profile": {
"reference": "http://registry.fhir.org/r5/StructureDefinition/7896271d-57f6-4231-89dc-dcc91eab2416"
},
"documentation": "This server does not let the clients create identities.",
"interaction": [
{
"code": "read"
},
{
"code": "vread",
"documentation": "Only supported for patient records since 12-Dec 2012"
},
{
"code": "update"
},
{
"code": "history-instance"
},
{
"code": "create"
},
{
"code": "history-type"
}
],
"versioning": "versioned-update",
"readHistory": true,
"updateCreate": false,
"conditionalCreate": true,
"conditionalRead": "full-support",
"conditionalUpdate": false,
"conditionalDelete": "not-supported",
"searchInclude": [
"Patient:organization"
],
"searchRevInclude": [
"Person:patient"
],
"searchParam": [
{
"name": "identifier",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-identifier",
"type": "token",
"documentation": "Only supports search by institution MRN"
},
{
"name": "general-practitioner",
"definition": "http://hl7.org/fhir/SearchParameter/Patient-general-practitioner",
"type": "reference"
}
]
}
],
"interaction": [
{
"code": "transaction"
},
{
"code": "history-system"
}
],
"compartment": [
"http://hl7.org/fhir/CompartmentDefinition/patient"
]
}
],
"messaging": [
{
"endpoint": [
{
"protocol": {
"system": "http://hl7.org/fhir/message-transport",
"code": "mllp"
},
"address": "mllp:10.1.1.10:9234"
}
],
"reliableCache": 30,
"documentation": "ADT A08 equivalent for external system notifications",
"supportedMessage": [
{
"mode": "receiver",
"definition": {
"reference": "http://hl7.org/fhir/MessageDefinition/example"
}
}
]
}
],
"document": [
{
"mode": "consumer",
"documentation": "Basic rules for all documents in the EHR system",
"profile": {
"reference": "http://fhir.hl7.org/base/Profilebc054d23-75e1-4dc6-aca5-838b6b1ac81d/_history/b5fdd9fc-b021-4ea1-911a-721a60663796"
}
}
]
}