diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java index 235b9aec546..419bd40f4ac 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java @@ -292,4 +292,12 @@ public class Bundle extends BaseBundle /* implements IElement */{ } + public static Bundle withResources(ArrayList theUploadBundle, FhirContext theContext, String theServerBase) { + Bundle retVal = new Bundle(); + for (IResource next : theUploadBundle) { + retVal.addResource(next, theContext, theServerBase); + } + return retVal; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java index 6e3d11a8669..65aea9d84fb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java @@ -164,6 +164,8 @@ public enum ResourceMetadataKeyEnum { } else { return (IdDt) retValObj; } + } else if (retValObj instanceof Number) { + return new IdDt(((Number)retValObj).toString()); } throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + IdDt.class.getCanonicalName()); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java index 56037921cd6..104291c11ff 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java @@ -114,7 +114,7 @@ public abstract class BaseHttpClientInvocationWithContents extends BaseHttpClien if (myTagList != null) { contents = parser.encodeTagListToString(myTagList); } else if (myResources != null) { - Bundle bundle = BaseResourceReturningMethodBinding.createBundleFromResourceList(myContext, "", myResources, theEncoding, theUrlBase, "", false, NarrativeModeEnum.NORMAL); + Bundle bundle = BaseResourceReturningMethodBinding.createBundleFromResourceList(myContext, "", myResources, theEncoding, "", "", false, NarrativeModeEnum.NORMAL); contents = parser.encodeBundleToString(bundle); } else { contents = parser.encodeResourceToString(myResource); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/provider/ServerConformanceProvider.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/provider/ServerConformanceProvider.java index 3061df6d07d..fe5e0a51df5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/provider/ServerConformanceProvider.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/provider/ServerConformanceProvider.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.rest.server.provider; */ import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -79,7 +80,14 @@ public class ServerConformanceProvider { Set systemOps = new HashSet(); - for (ResourceBinding next : myRestfulServer.getResourceBindings()) { + List bindings = new ArrayList(myRestfulServer.getResourceBindings()); + Collections.sort(bindings, new Comparator() { + @Override + public int compare(ResourceBinding theArg0, ResourceBinding theArg1) { + return theArg0.getResourceName().compareToIgnoreCase(theArg1.getResourceName()); + }}); + + for (ResourceBinding next : bindings) { Set resourceOps = new HashSet(); RestResource resource = rest.addResource(); diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html index af632b51b8e..520a6b4e2e6 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html @@ -66,7 +66,7 @@ This file is a Thymeleaf template for the Pretty Printing - + diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTesterResult.html b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTesterResult.html index 62ec9972632..0a930f202b4 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTesterResult.html +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTesterResult.html @@ -28,7 +28,8 @@ This file is a Thymeleaf template for the
- Executed invocation against FHIR RESTful Server in ${latencyMs}ms + Executed invocation against FHIR RESTful Server in +
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java index b942a4d77ce..cce8b010ca9 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/TransactionClientTest.java @@ -79,15 +79,15 @@ public class TransactionClientTest { client.searchWithParam(resources); assertEquals(HttpPost.class, capt.getValue().getClass()); - HttpPost get = (HttpPost) capt.getValue(); - assertEquals("http://foo/", get.getURI().toString()); + HttpPost post = (HttpPost) capt.getValue(); + assertEquals("http://foo/", post.getURI().toString()); - Bundle bundle = ctx.newXmlParser().parseBundle(new InputStreamReader(get.getEntity().getContent())); + Bundle bundle = ctx.newXmlParser().parseBundle(new InputStreamReader(post.getEntity().getContent())); ourLog.info(ctx.newXmlParser().setPrettyPrint(true).encodeBundleToString(bundle)); assertEquals(2, bundle.size()); - assertEquals("http://foo/Patient/testPersistWithSimpleLinkP01", bundle.getEntries().get(0).getId().getValue()); - assertEquals("http://foo/Patient/testPersistWithSimpleLinkP01", bundle.getEntries().get(0).getLinkSelf().getValue()); + assertEquals("Patient/testPersistWithSimpleLinkP01", bundle.getEntries().get(0).getId().getValue()); + assertEquals("Patient/testPersistWithSimpleLinkP01", bundle.getEntries().get(0).getLinkSelf().getValue()); assertEquals(null, bundle.getEntries().get(0).getLinkAlternate().getValue()); assertTrue(bundle.getEntries().get(1).getId().isEmpty()); diff --git a/hapi-fhir-jpaserver-base/.gitignore b/hapi-fhir-jpaserver-base/.gitignore index 548aaf5e303..648d12594d2 100644 --- a/hapi-fhir-jpaserver-base/.gitignore +++ b/hapi-fhir-jpaserver-base/.gitignore @@ -1,2 +1,3 @@ target/ /bin +nohup.out diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index f823cb36fb6..78eba74bc49 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -21,6 +21,12 @@ 0.4-SNAPSHOT + + ch.qos.logback + logback-classic + 1.1.1 + test + junit junit diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java index 4e4ddd88de2..b96d5a3fca8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java @@ -238,6 +238,10 @@ public abstract class BaseFhirDao { if (nextValue.isEmpty()) { continue; } + if (nextValue.getReference().getValue().startsWith("#")) { + // This is a contained resource reference + continue; + } String typeString = nextValue.getResourceId().getResourceType(); if (isBlank(typeString)) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java index fdc648d57df..e39f54fc0dc 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java @@ -73,8 +73,15 @@ public class FhirSystemDao extends BaseFhirDao implements IFhirSystemDao { } IdDt newId = new IdDt(resourceName + '/' + entity.getId()); - ourLog.info("Incoming ID[{}] has been assigned ID[{}]", nextId, newId); - idConversions.put(nextId, newId); + if (nextId.isEmpty()) { + ourLog.info("Transaction resource (with no preexisting ID) has been assigned new ID[{}]", nextId, newId); + } else if (newId.equals(entity.getId())) { + ourLog.info("Transaction resource ID[{}] is being updated", newId); + } else { + ourLog.info("Transaction resource ID[{}] has been assigned new ID[{}]", nextId, newId); + idConversions.put(nextId, newId); + } + persistedResources.add(entity); } @@ -87,6 +94,8 @@ public class FhirSystemDao extends BaseFhirDao implements IFhirSystemDao { IdDt newId = idConversions.get(nextId); ourLog.info(" * Replacing resource ref {} with {}", nextId, newId); nextRef.setResourceId(newId); + } else { + ourLog.info(" * Reference [{}] does not exist in bundle", nextId); } } } @@ -106,38 +115,38 @@ public class FhirSystemDao extends BaseFhirDao implements IFhirSystemDao { @Override public TagList getAllTags() { -// CriteriaBuilder builder = myEntityManager.getCriteriaBuilder(); -// CriteriaQuery cq = builder.createQuery(Tag) -// Root from = cq.from(ResourceTable.class); -// cq.multiselect(from.get("myId").as(Long.class), from.get("myUpdated").as(Date.class)); -// -// List predicates = new ArrayList(); -// if (theSince != null) { -// Predicate low = builder.greaterThanOrEqualTo(from. get("myUpdated"), theSince); -// predicates.add(low); -// } -// -// if (theResourceName != null) { -// predicates.add(builder.equal(from.get("myResourceType"), theResourceName)); -// } -// if (theId != null) { -// predicates.add(builder.equal(from.get("myId"), theId)); -// } -// -// cq.where(builder.and(predicates.toArray(new Predicate[0]))); -// -// cq.orderBy(builder.desc(from.get("myUpdated"))); -// TypedQuery q = myEntityManager.createQuery(cq); -// if (theLimit > 0) { -// q.setMaxResults(theLimit); -// } -// for (Tuple next : q.getResultList()) { -// long id = (Long) next.get(0); -// Date updated = (Date) next.get(1); -// tuples.add(new HistoryTuple(ResourceTable.class, updated, id)); -// } + // CriteriaBuilder builder = myEntityManager.getCriteriaBuilder(); + // CriteriaQuery cq = builder.createQuery(Tag) + // Root from = cq.from(ResourceTable.class); + // cq.multiselect(from.get("myId").as(Long.class), from.get("myUpdated").as(Date.class)); + // + // List predicates = new ArrayList(); + // if (theSince != null) { + // Predicate low = builder.greaterThanOrEqualTo(from. get("myUpdated"), theSince); + // predicates.add(low); + // } + // + // if (theResourceName != null) { + // predicates.add(builder.equal(from.get("myResourceType"), theResourceName)); + // } + // if (theId != null) { + // predicates.add(builder.equal(from.get("myId"), theId)); + // } + // + // cq.where(builder.and(predicates.toArray(new Predicate[0]))); + // + // cq.orderBy(builder.desc(from.get("myUpdated"))); + // TypedQuery q = myEntityManager.createQuery(cq); + // if (theLimit > 0) { + // q.setMaxResults(theLimit); + // } + // for (Tuple next : q.getResultList()) { + // long id = (Long) next.get(0); + // Date updated = (Date) next.get(1); + // tuples.add(new HistoryTuple(ResourceTable.class, updated, id)); + // } - return null; + return null; } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java index a1915ea74a0..98d3676f817 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java @@ -45,8 +45,8 @@ public interface IFhirResourceDao { List history(); - List history(Date theDate, int theLimit); + List history(Date theDate, Integer theLimit); - List history(Long theId, Date theSince, int theLimit); + List history(Long theId, Date theSince, Integer theLimit); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java index f1bbf925df7..6471a80d01f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirSystemDao.java @@ -10,7 +10,7 @@ public interface IFhirSystemDao { void transaction(List theResources); - List history(Date theDate, int theLimit); + List history(Date theDate, Integer theLimit); TagList getAllTags(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java index 70714efebb2..abe086351be 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java @@ -4,6 +4,8 @@ import java.util.Collection; import java.util.Date; import javax.persistence.Column; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.Lob; import javax.persistence.MappedSuperclass; import javax.persistence.Temporal; @@ -17,7 +19,8 @@ import ca.uhn.fhir.rest.server.EncodingEnum; @MappedSuperclass public abstract class BaseHasResource { - @Column(name = "RES_ENCODING", nullable = false) + @Column(name = "RES_ENCODING", nullable = false, length=4) + @Enumerated(EnumType.STRING) private EncodingEnum myEncoding; @Temporal(TemporalType.TIMESTAMP) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java index 4fc696e57dd..521beb7a31c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java @@ -20,7 +20,6 @@ import javax.persistence.Version; import org.hibernate.annotations.Index; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.server.Constants; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProvider.java index eca33572de3..43e882fdf3d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProvider.java @@ -38,7 +38,7 @@ public class JpaSystemProvider { } @History - List getHistoryServerWithCriteria(@Since Date theDate, @Count Integer theCount) { + public List getHistoryServerWithCriteria(@Since Date theDate, @Count Integer theCount) { return myDao.history(theDate, theCount); } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java index 3a6c515b7a6..c50bc07b272 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java @@ -3,15 +3,20 @@ package ca.uhn.fhir.jpa.dao; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.Arrays; import java.util.Date; import java.util.List; +import org.apache.commons.io.IOUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.composite.IdentifierDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; @@ -83,6 +88,16 @@ public class FhirSystemDaoTest { } + @Test + public void testTransactionFromBundle() throws Exception { + + InputStream bundleRes = FhirSystemDaoTest.class.getResourceAsStream("/bundle.json"); + Bundle bundle = new FhirContext().newJsonParser().parseBundle(new InputStreamReader(bundleRes)); + List res = bundle.toListOfResources(); + + ourSystemDao.transaction(res); + } + @Test public void testPersistWithSimpleLink() { Patient patient = new Patient(); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/bundle.json b/hapi-fhir-jpaserver-base/src/test/resources/bundle.json new file mode 100644 index 00000000000..420c0dd240f --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/bundle.json @@ -0,0 +1,690 @@ + +{ + "resourceType":"Bundle", + "entry":[ + { + "deleted":null, + "title":"Patient http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "id":"Patient/5556918", + "link":[ + { + "rel":"self", + "href":"Patient/5556918" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Patient", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "text":{ + "status":"generated", + "div":"
Donald null DUCK
Identifier7000135
Address10 Duxon Street
VICTORIA BC Can
Date of birth01 June 1980
" + }, + "identifier":[ + { + "use":"official", + "label":"University Health Network MRN 7000135", + "system":"urn:oid:2.16.840.1.113883.3.239.18.148", + "value":"7000135", + "assigner":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + ], + "name":[ + { + "family":[ + "Duck" + ], + "given":[ + "Donald" + ] + } + ], + "telecom":[ + { + "system":"phone", + "use":"home" + }, + { + "system":"phone", + "use":"work" + }, + { + "system":"phone", + "use":"mobile" + }, + { + "system":"email", + "use":"home" + } + ], + "gender":{ + "coding":[ + { + "system":"http://hl7.org/fhir/v3/AdministrativeGender", + "code":"M" + } + ] + }, + "birthDate":"1980-06-01T00:00:00", + "address":[ + { + "use":"home", + "line":[ + "10 Duxon Street" + ], + "city":"VICTORIA", + "state":"BC", + "zip":"V8N 1Y4", + "country":"Can" + } + ], + "managingOrganization":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + }, + { + "deleted":null, + "title":"DiagnosticReport http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "id":"DiagnosticReport/5978827", + "link":[ + { + "rel":"self", + "href":"DiagnosticReport/5978827" + } + ], + "published":"2014-05-29T10:49:33-04:00", + "content":{ + "resourceType":"DiagnosticReport", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "text":{ + "status":"generated", + "div":"
C&S
Statuspartial
Issued 29 April 2014 17:21:56
NameValueInterpretationReference RangeStatus
Collection Info Spec #102758: 26 Sep 08 1117preliminary
Direct Stain pus cellspreliminary
Header To view Culture & Sensitivity Results, select
Header (Y) Report Query. Do NOT select number beside
Header Prelim or Final Result field, as there is
Header potential for viewing an incomplete report.
Organism Haemophilus influenzaefinal
Qualifier =>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.final
Sensitivities _Beta-lactamase Pos: final
Test Comment =>10 x E6 cfu/L Commensal florafinal
" + }, + "contained":[ + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + } + ], + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.5", + "code":"4140" + } + ], + "text":"C&S" + }, + "status":"partial", + "issued":"2014-04-29T17:21:56", + "subject":{ + "resource":"Patient/5556918" + }, + "identifier":{ + "value":"2363922" + }, + "diagnosticDateTime":"2014-04-14T00:00:00-04:00", + "result":[ + { + "resource":"#f816a276-cfad-4eca-a9fa-f1dff844a196" + }, + { + "resource":"#23b55496-1c2a-4d5f-9c24-8ca5042f4027" + }, + { + "resource":"#74e6791a-d810-4545-8410-e9eca41e81d6" + }, + { + "resource":"#cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee" + }, + { + "resource":"#4a3d453d-3a18-432f-8f1f-d7657c50dcd4" + }, + { + "resource":"#0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af" + }, + { + "resource":"#6d6b0117-220f-4b9a-abf3-5faf772cfa61" + }, + { + "resource":"#64068acf-57f4-42c8-b0e6-416247067b16" + }, + { + "resource":"#0f9d254f-3ad1-404b-9be9-20258b3c242f" + }, + { + "resource":"#349bb02b-fbbe-4ce0-b190-3f545240dcc0" + } + ] + } + }, + { + "deleted":null, + "title":"Organization http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "id":"Organization/1.3.6.1.4.1.12201", + "link":[ + { + "rel":"self", + "href":"Organization/1.3.6.1.4.1.12201" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Organization", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "extension":[ + { + "url":"http://fhir.connectinggta.ca/Profile/organization#providerIdPool", + "valueUri":"1.3.6.1.4.1.12201.1" + } + ], + "text":{ + "status":"empty", + "div":"
No narrative template available for resource profile: http://fhir.connectinggta.ca/Profile/organization
" + }, + "contained":[ + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + } + ], + "name":"University Health Network", + "type":{ + "coding":[ + { + "code":"HOSPITAL" + } + ] + }, + "address":[ + { + "line":[ + "R. Fraser Elliott Building, 1st Floor", + "190 Elizabeth St." + ], + "city":"Toronto", + "state":"ON", + "zip":"M5G 2C4" + } + ], + "location":[ + { + "resource":"#1.3.6.1.4.1.12201.100.1" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.2" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.3" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.4" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/hapi-fhir-jpaserver-test/src/test/java/ca/uhn/fhir/jpa/test/SystemTest.java b/hapi-fhir-jpaserver-test/src/test/java/ca/uhn/fhir/jpa/test/SystemTest.java new file mode 100644 index 00000000000..cb102375142 --- /dev/null +++ b/hapi-fhir-jpaserver-test/src/test/java/ca/uhn/fhir/jpa/test/SystemTest.java @@ -0,0 +1,112 @@ +package ca.uhn.fhir.jpa.test; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.List; + +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.dao.IFhirSystemDao; +import ca.uhn.fhir.jpa.provider.JpaSystemProvider; +import ca.uhn.fhir.model.api.Bundle; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu.resource.Observation; +import ca.uhn.fhir.model.dstu.resource.Organization; +import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.model.dstu.resource.Questionnaire; +import ca.uhn.fhir.rest.client.IGenericClient; +import ca.uhn.fhir.rest.server.RestfulServer; +import ca.uhn.fhir.rest.server.tester.RestfulServerTesterServlet; +import ca.uhn.test.jpasrv.ObservationResourceProvider; +import ca.uhn.test.jpasrv.OrganizationResourceProvider; +import ca.uhn.test.jpasrv.PatientResourceProvider; + +public class SystemTest { + + + private static Server ourServer; + private static ClassPathXmlApplicationContext ourAppCtx; + private static FhirContext ourCtx; + private static IGenericClient ourClient; + + @Test + public void testTransactionFromBundle() throws Exception { + + InputStream bundleRes = SystemTest.class.getResourceAsStream("/bundle.json"); + Bundle bundle = new FhirContext().newJsonParser().parseBundle(new InputStreamReader(bundleRes)); + List res = bundle.toListOfResources(); + + ourClient.transaction(res); + + } + + + @AfterClass + public static void afterClass() throws Exception { + ourServer.stop(); + ourAppCtx.stop(); + } + + @SuppressWarnings("unchecked") + @BeforeClass + public static void beforeClass() throws Exception { + ourAppCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml"); + + IFhirResourceDao patientDao = (IFhirResourceDao) ourAppCtx.getBean("myPatientDao", IFhirResourceDao.class); + PatientResourceProvider patientRp = new PatientResourceProvider(); + patientRp.setDao(patientDao); + + IFhirResourceDao questionnaireDao = (IFhirResourceDao) ourAppCtx.getBean("myQuestionnaireDao", IFhirResourceDao.class); + QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider(); + questionnaireRp.setDao(questionnaireDao); + + IFhirResourceDao observationDao = (IFhirResourceDao) ourAppCtx.getBean("myObservationDao", IFhirResourceDao.class); + ObservationResourceProvider observationRp = new ObservationResourceProvider(); + observationRp.setDao(observationDao); + + IFhirSystemDao systemDao = ourAppCtx.getBean("mySystemDao", IFhirSystemDao.class); + + IFhirResourceDao organizationDao = (IFhirResourceDao) ourAppCtx.getBean("myOrganizationDao", IFhirResourceDao.class); + OrganizationResourceProvider organizationRp = new OrganizationResourceProvider(); + organizationRp.setDao(organizationDao); + + RestfulServer restServer = new RestfulServer(); + restServer.setResourceProviders(patientRp, questionnaireRp, observationRp, organizationRp); + restServer.setPlainProviders(new JpaSystemProvider(systemDao)); + + int myPort = 8888; + ourServer = new Server(myPort); + + ServletContextHandler proxyHandler = new ServletContextHandler(); + proxyHandler.setContextPath("/"); + + RestfulServerTesterServlet testerServlet = new RestfulServerTesterServlet(); + String serverBase = "http://localhost:" + myPort + "/fhir/context"; + testerServlet.setServerBase(serverBase); + // testerServlet.setServerBase("http://fhir.healthintersections.com.au/open"); + ServletHolder handler = new ServletHolder(); + handler.setServlet(testerServlet); + proxyHandler.addServlet(handler, "/fhir/tester/*"); + + ServletHolder servletHolder = new ServletHolder(); + servletHolder.setServlet(restServer); + proxyHandler.addServlet(servletHolder, "/fhir/context/*"); + + ourServer.setHandler(proxyHandler); + ourServer.start(); + + ourCtx = restServer.getFhirContext(); + + ourClient = ourCtx.newRestfulGenericClient(serverBase); + ourClient.setLogRequestAndResponse(true); + } + +} diff --git a/hapi-fhir-jpaserver-test/src/test/resources/bundle.json b/hapi-fhir-jpaserver-test/src/test/resources/bundle.json new file mode 100644 index 00000000000..420c0dd240f --- /dev/null +++ b/hapi-fhir-jpaserver-test/src/test/resources/bundle.json @@ -0,0 +1,690 @@ + +{ + "resourceType":"Bundle", + "entry":[ + { + "deleted":null, + "title":"Patient http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "id":"Patient/5556918", + "link":[ + { + "rel":"self", + "href":"Patient/5556918" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Patient", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "text":{ + "status":"generated", + "div":"
Donald null DUCK
Identifier7000135
Address10 Duxon Street
VICTORIA BC Can
Date of birth01 June 1980
" + }, + "identifier":[ + { + "use":"official", + "label":"University Health Network MRN 7000135", + "system":"urn:oid:2.16.840.1.113883.3.239.18.148", + "value":"7000135", + "assigner":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + ], + "name":[ + { + "family":[ + "Duck" + ], + "given":[ + "Donald" + ] + } + ], + "telecom":[ + { + "system":"phone", + "use":"home" + }, + { + "system":"phone", + "use":"work" + }, + { + "system":"phone", + "use":"mobile" + }, + { + "system":"email", + "use":"home" + } + ], + "gender":{ + "coding":[ + { + "system":"http://hl7.org/fhir/v3/AdministrativeGender", + "code":"M" + } + ] + }, + "birthDate":"1980-06-01T00:00:00", + "address":[ + { + "use":"home", + "line":[ + "10 Duxon Street" + ], + "city":"VICTORIA", + "state":"BC", + "zip":"V8N 1Y4", + "country":"Can" + } + ], + "managingOrganization":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + }, + { + "deleted":null, + "title":"DiagnosticReport http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "id":"DiagnosticReport/5978827", + "link":[ + { + "rel":"self", + "href":"DiagnosticReport/5978827" + } + ], + "published":"2014-05-29T10:49:33-04:00", + "content":{ + "resourceType":"DiagnosticReport", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "text":{ + "status":"generated", + "div":"
C&S
Statuspartial
Issued 29 April 2014 17:21:56
NameValueInterpretationReference RangeStatus
Collection Info Spec #102758: 26 Sep 08 1117preliminary
Direct Stain pus cellspreliminary
Header To view Culture & Sensitivity Results, select
Header (Y) Report Query. Do NOT select number beside
Header Prelim or Final Result field, as there is
Header potential for viewing an incomplete report.
Organism Haemophilus influenzaefinal
Qualifier =>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.final
Sensitivities _Beta-lactamase Pos: final
Test Comment =>10 x E6 cfu/L Commensal florafinal
" + }, + "contained":[ + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + } + ], + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.5", + "code":"4140" + } + ], + "text":"C&S" + }, + "status":"partial", + "issued":"2014-04-29T17:21:56", + "subject":{ + "resource":"Patient/5556918" + }, + "identifier":{ + "value":"2363922" + }, + "diagnosticDateTime":"2014-04-14T00:00:00-04:00", + "result":[ + { + "resource":"#f816a276-cfad-4eca-a9fa-f1dff844a196" + }, + { + "resource":"#23b55496-1c2a-4d5f-9c24-8ca5042f4027" + }, + { + "resource":"#74e6791a-d810-4545-8410-e9eca41e81d6" + }, + { + "resource":"#cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee" + }, + { + "resource":"#4a3d453d-3a18-432f-8f1f-d7657c50dcd4" + }, + { + "resource":"#0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af" + }, + { + "resource":"#6d6b0117-220f-4b9a-abf3-5faf772cfa61" + }, + { + "resource":"#64068acf-57f4-42c8-b0e6-416247067b16" + }, + { + "resource":"#0f9d254f-3ad1-404b-9be9-20258b3c242f" + }, + { + "resource":"#349bb02b-fbbe-4ce0-b190-3f545240dcc0" + } + ] + } + }, + { + "deleted":null, + "title":"Organization http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "id":"Organization/1.3.6.1.4.1.12201", + "link":[ + { + "rel":"self", + "href":"Organization/1.3.6.1.4.1.12201" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Organization", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "extension":[ + { + "url":"http://fhir.connectinggta.ca/Profile/organization#providerIdPool", + "valueUri":"1.3.6.1.4.1.12201.1" + } + ], + "text":{ + "status":"empty", + "div":"
No narrative template available for resource profile: http://fhir.connectinggta.ca/Profile/organization
" + }, + "contained":[ + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + } + ], + "name":"University Health Network", + "type":{ + "coding":[ + { + "code":"HOSPITAL" + } + ] + }, + "address":[ + { + "line":[ + "R. Fraser Elliott Building, 1st Floor", + "190 Elizabeth St." + ], + "city":"Toronto", + "state":"ON", + "zip":"M5G 2C4" + } + ], + "location":[ + { + "resource":"#1.3.6.1.4.1.12201.100.1" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.2" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.3" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.4" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/hapi-fhir-jpaserver-test/src/test/resources/fhir-spring-test-config.xml b/hapi-fhir-jpaserver-test/src/test/resources/fhir-spring-test-config.xml index b761e8b75dd..e5588781269 100644 --- a/hapi-fhir-jpaserver-test/src/test/resources/fhir-spring-test-config.xml +++ b/hapi-fhir-jpaserver-test/src/test/resources/fhir-spring-test-config.xml @@ -29,6 +29,9 @@ + + + diff --git a/hapi-fhir-jpaserver-uhnfhirtest/.gitignore b/hapi-fhir-jpaserver-uhnfhirtest/.gitignore index 25438761855..4b8ea92d447 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/.gitignore +++ b/hapi-fhir-jpaserver-uhnfhirtest/.gitignore @@ -1,3 +1,4 @@ myUnitTestDB/ target/ /bin +nohup.out diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java index 82949c7719f..e62fbc1bc51 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java @@ -23,9 +23,10 @@ public class TestRestfulServer extends RestfulServer { super.initialize(); try { + ourLog.info("Creating database"); DriverManager.getConnection("jdbc:derby:directory:" + System.getProperty("fhir.db.location") + ";create=true"); } catch (Exception e) { - ourLog.info("Failed to create database: {}",e.getMessage()); + ourLog.error("Failed to create database: {}",e); } myAppCtx = new ClassPathXmlApplicationContext("fhir-spring-uhnfhirtest-config.xml", "hapi-jpaserver-springbeans.xml"); @@ -46,6 +47,13 @@ public class TestRestfulServer extends RestfulServer { super.destroy(); myAppCtx.close(); + + try { + ourLog.info("Shutting down derby"); + DriverManager.getConnection("jdbc:derby:directory:" + System.getProperty("fhir.db.location") + ";shutdown=true"); + } catch (Exception e) { + ourLog.info("Failed to create database: {}",e.getMessage()); + } } } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/META-INF/fhirtest_persistence.xml b/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/META-INF/fhirtest_persistence.xml index 82d9904d485..4d5b825eea3 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/META-INF/fhirtest_persistence.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/META-INF/fhirtest_persistence.xml @@ -15,6 +15,7 @@ ca.uhn.fhir.jpa.entity.ResourceLink ca.uhn.fhir.jpa.entity.ResourceTable ca.uhn.fhir.jpa.entity.ResourceTag + ca.uhn.fhir.jpa.entity.TagDefinition true diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/fhir-spring-uhnfhirtest-config.xml b/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/fhir-spring-uhnfhirtest-config.xml index bd6417e266c..aac3c4fdf53 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/fhir-spring-uhnfhirtest-config.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/resources/fhir-spring-uhnfhirtest-config.xml @@ -20,7 +20,7 @@ - + diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/test/resources/bundle.json b/hapi-fhir-jpaserver-uhnfhirtest/src/test/resources/bundle.json new file mode 100644 index 00000000000..420c0dd240f --- /dev/null +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/test/resources/bundle.json @@ -0,0 +1,690 @@ + +{ + "resourceType":"Bundle", + "entry":[ + { + "deleted":null, + "title":"Patient http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "id":"Patient/5556918", + "link":[ + { + "rel":"self", + "href":"Patient/5556918" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Patient", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Patient/5556918", + "text":{ + "status":"generated", + "div":"
Donald null DUCK
Identifier7000135
Address10 Duxon Street
VICTORIA BC Can
Date of birth01 June 1980
" + }, + "identifier":[ + { + "use":"official", + "label":"University Health Network MRN 7000135", + "system":"urn:oid:2.16.840.1.113883.3.239.18.148", + "value":"7000135", + "assigner":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + ], + "name":[ + { + "family":[ + "Duck" + ], + "given":[ + "Donald" + ] + } + ], + "telecom":[ + { + "system":"phone", + "use":"home" + }, + { + "system":"phone", + "use":"work" + }, + { + "system":"phone", + "use":"mobile" + }, + { + "system":"email", + "use":"home" + } + ], + "gender":{ + "coding":[ + { + "system":"http://hl7.org/fhir/v3/AdministrativeGender", + "code":"M" + } + ] + }, + "birthDate":"1980-06-01T00:00:00", + "address":[ + { + "use":"home", + "line":[ + "10 Duxon Street" + ], + "city":"VICTORIA", + "state":"BC", + "zip":"V8N 1Y4", + "country":"Can" + } + ], + "managingOrganization":{ + "resource":"Organization/1.3.6.1.4.1.12201" + } + } + }, + { + "deleted":null, + "title":"DiagnosticReport http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "id":"DiagnosticReport/5978827", + "link":[ + { + "rel":"self", + "href":"DiagnosticReport/5978827" + } + ], + "published":"2014-05-29T10:49:33-04:00", + "content":{ + "resourceType":"DiagnosticReport", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/DiagnosticReport/5978827", + "text":{ + "status":"generated", + "div":"
C&S
Statuspartial
Issued 29 April 2014 17:21:56
NameValueInterpretationReference RangeStatus
Collection Info Spec #102758: 26 Sep 08 1117preliminary
Direct Stain pus cellspreliminary
Header To view Culture & Sensitivity Results, select
Header (Y) Report Query. Do NOT select number beside
Header Prelim or Final Result field, as there is
Header potential for viewing an incomplete report.
Organism Haemophilus influenzaefinal
Qualifier =>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.final
Sensitivities _Beta-lactamase Pos: final
Test Comment =>10 x E6 cfu/L Commensal florafinal
" + }, + "contained":[ + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"f816a276-cfad-4eca-a9fa-f1dff844a196", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"146151.1" + } + ], + "text":"Collection Info" + }, + "valueString":"Spec #102758: 26 Sep 08 1117", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"23b55496-1c2a-4d5f-9c24-8ca5042f4027", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"GM.2" + } + ], + "text":"Direct Stain" + }, + "valueString":"pus cells", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"preliminary" + }, + { + "resourceType":"Observation", + "id":"74e6791a-d810-4545-8410-e9eca41e81d6", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H1.3" + } + ], + "text":"Header" + }, + "valueString":"To view Culture & Sensitivity Results, select", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H2.4" + } + ], + "text":"Header" + }, + "valueString":"(Y) Report Query. Do NOT select number beside", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"4a3d453d-3a18-432f-8f1f-d7657c50dcd4", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H3.5" + } + ], + "text":"Header" + }, + "valueString":"Prelim or Final Result field, as there is", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"1H4.6" + } + ], + "text":"Header" + }, + "valueString":"potential for viewing an incomplete report.", + "issued":"2014-04-29T17:21:56" + }, + { + "resourceType":"Observation", + "id":"6d6b0117-220f-4b9a-abf3-5faf772cfa61", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/O.4" + } + ], + "text":"Organism" + }, + "valueString":"Haemophilus influenzae", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"64068acf-57f4-42c8-b0e6-416247067b16", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31266.5" + } + ], + "text":"Qualifier" + }, + "valueString":"=>10 x E6 cfu/L SIGNIFICANT RESULT. Organisms cultured in quantities =>10 x E6 cfu/L are consistent with pneumonia. beta-lactamase positive result suggests resistance to ampicillin but generally susceptible to amoxicillin- clavulanic and cefuroxime.", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"0f9d254f-3ad1-404b-9be9-20258b3c242f", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"F/31415.6" + } + ], + "text":"Sensitivities" + }, + "valueString":"_Beta-lactamase Pos: ", + "interpretation":{ + "coding":[ + { + "code":"A" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + }, + { + "resourceType":"Observation", + "id":"349bb02b-fbbe-4ce0-b190-3f545240dcc0", + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.6", + "code":"Q.3" + } + ], + "text":"Test Comment" + }, + "valueString":"=>10 x E6 cfu/L Commensal flora", + "interpretation":{ + "coding":[ + { + "code":"N" + } + ] + }, + "issued":"2014-04-29T17:21:56", + "status":"final" + } + ], + "name":{ + "coding":[ + { + "system":"urn:oid:1.3.6.1.4.1.12201.102.5", + "code":"4140" + } + ], + "text":"C&S" + }, + "status":"partial", + "issued":"2014-04-29T17:21:56", + "subject":{ + "resource":"Patient/5556918" + }, + "identifier":{ + "value":"2363922" + }, + "diagnosticDateTime":"2014-04-14T00:00:00-04:00", + "result":[ + { + "resource":"#f816a276-cfad-4eca-a9fa-f1dff844a196" + }, + { + "resource":"#23b55496-1c2a-4d5f-9c24-8ca5042f4027" + }, + { + "resource":"#74e6791a-d810-4545-8410-e9eca41e81d6" + }, + { + "resource":"#cd8c6a6c-7ef5-446f-b07b-47a21bfe28ee" + }, + { + "resource":"#4a3d453d-3a18-432f-8f1f-d7657c50dcd4" + }, + { + "resource":"#0dd6cff6-f9db-42cc-89c9-2cd6ba6fe5af" + }, + { + "resource":"#6d6b0117-220f-4b9a-abf3-5faf772cfa61" + }, + { + "resource":"#64068acf-57f4-42c8-b0e6-416247067b16" + }, + { + "resource":"#0f9d254f-3ad1-404b-9be9-20258b3c242f" + }, + { + "resource":"#349bb02b-fbbe-4ce0-b190-3f545240dcc0" + } + ] + } + }, + { + "deleted":null, + "title":"Organization http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "id":"Organization/1.3.6.1.4.1.12201", + "link":[ + { + "rel":"self", + "href":"Organization/1.3.6.1.4.1.12201" + } + ], + "published":"2014-05-29T10:49:32-04:00", + "content":{ + "resourceType":"Organization", + "id":"http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.0/Organization/1.3.6.1.4.1.12201", + "extension":[ + { + "url":"http://fhir.connectinggta.ca/Profile/organization#providerIdPool", + "valueUri":"1.3.6.1.4.1.12201.1" + } + ], + "text":{ + "status":"empty", + "div":"
No narrative template available for resource profile: http://fhir.connectinggta.ca/Profile/organization
" + }, + "contained":[ + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.1", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.1" + }, + "name":"Toronto General Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.2", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.2" + }, + "name":"Toronto Western Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.3", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.3" + }, + "name":"Princess Margaret Hospital" + }, + { + "resourceType":"Location", + "id":"1.3.6.1.4.1.12201.100.4", + "identifier":{ + "system":"urn:cgta:facility_ids", + "value":"1.3.6.1.4.1.12201.100.4" + }, + "name":"Toronto Rehab Institute" + } + ], + "name":"University Health Network", + "type":{ + "coding":[ + { + "code":"HOSPITAL" + } + ] + }, + "address":[ + { + "line":[ + "R. Fraser Elliott Building, 1st Floor", + "190 Elizabeth St." + ], + "city":"Toronto", + "state":"ON", + "zip":"M5G 2C4" + } + ], + "location":[ + { + "resource":"#1.3.6.1.4.1.12201.100.1" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.2" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.3" + }, + { + "resource":"#1.3.6.1.4.1.12201.100.4" + } + ] + } + } + ] +} \ No newline at end of file