Search in sources :

Example 1 with FhirResourceProcessor

use of net.geoprism.registry.etl.fhir.FhirResourceProcessor in project geoprism-registry by terraframe.

the class FhirImportTest method testBasicImport.

@Request
@Test
public void testBasicImport() throws InterruptedException {
    try {
        FhirExternalSystem system = createExternalSystem();
        SynchronizationConfig config = createSyncConfig(system);
        FhirSyncImportConfig iConfig = (FhirSyncImportConfig) config.buildConfiguration();
        FhirResourceProcessor processor = FhirFactory.getProcessor(iConfig.getImplementation());
        IParser parser = FhirContext.forR4().newJsonParser();
        Bundle bundle = new Bundle();
        bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/organization.json"))));
        bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/location.json"))));
        FhirResourceImporter importer = new FhirResourceImporter(new BasicFhirConnection(system), processor, null, null);
        importer.synchronize(bundle);
        ServerGeoObjectIF geoobject = new ServerGeoObjectService().getGeoObjectByCode("USATestDataHsTwo", "USATestDataHealthStop");
        geoobject.setDate(new Date());
        LocalizedValue displayLabel = geoobject.getDisplayLabel();
        Assert.assertEquals("USATestDataHsTwo ZZZZZZZ", displayLabel.getValue());
    } finally {
        TestDataSet.deleteExternalSystems("FHIRImportTest");
    }
}
Also used : FhirResourceImporter(net.geoprism.registry.etl.fhir.FhirResourceImporter) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) Bundle(org.hl7.fhir.r4.model.Bundle) Resource(org.hl7.fhir.r4.model.Resource) BasicFhirResourceProcessor(net.geoprism.registry.etl.fhir.BasicFhirResourceProcessor) FhirResourceProcessor(net.geoprism.registry.etl.fhir.FhirResourceProcessor) BasicFhirConnection(net.geoprism.registry.etl.fhir.BasicFhirConnection) FhirExternalSystem(net.geoprism.registry.graph.FhirExternalSystem) Date(java.util.Date) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) SynchronizationConfig(net.geoprism.registry.SynchronizationConfig) IParser(ca.uhn.fhir.parser.IParser) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

IParser (ca.uhn.fhir.parser.IParser)1 Request (com.runwaysdk.session.Request)1 Date (java.util.Date)1 SynchronizationConfig (net.geoprism.registry.SynchronizationConfig)1 BasicFhirConnection (net.geoprism.registry.etl.fhir.BasicFhirConnection)1 BasicFhirResourceProcessor (net.geoprism.registry.etl.fhir.BasicFhirResourceProcessor)1 FhirResourceImporter (net.geoprism.registry.etl.fhir.FhirResourceImporter)1 FhirResourceProcessor (net.geoprism.registry.etl.fhir.FhirResourceProcessor)1 ServerGeoObjectService (net.geoprism.registry.geoobject.ServerGeoObjectService)1 FhirExternalSystem (net.geoprism.registry.graph.FhirExternalSystem)1 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)1 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)1 Bundle (org.hl7.fhir.r4.model.Bundle)1 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)1 Resource (org.hl7.fhir.r4.model.Resource)1 Test (org.junit.Test)1