Loading i2b2-integration-tests/.gitignore 0 → 100644 +4 −0 Original line number Diff line number Diff line .settings/ .classpath .project target/ i2b2-integration-tests/pom.xml 0 → 100644 +62 −0 Original line number Diff line number Diff line <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <name>HIStream : i2b2 integration tests</name> <groupId>de.sekmi.histream</groupId> <artifactId>i2b2-intregration-tests</artifactId> <version>0.5-SNAPSHOT</version> <parent> <groupId>de.sekmi.histream</groupId> <artifactId>histream</artifactId> <version>0.5-SNAPSHOT</version> </parent> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18.1</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-i2b2</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-skos</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-import</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-import</artifactId> <version>0.5-SNAPSHOT</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18.1</version> <scope>test</scope> </dependency> </dependencies> </project> No newline at end of file i2b2-integration-tests/src/test/java/de/sekmi/histream/i2b2/ITImportData.java 0 → 100644 +50 −0 Original line number Diff line number Diff line package de.sekmi.histream.i2b2; import java.io.InputStream; import java.io.UncheckedIOException; import java.util.Map; import java.util.Properties; import java.util.function.Supplier; import org.junit.Test; import de.sekmi.histream.Observation; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.etl.ETLObservationSupplier; import de.sekmi.histream.impl.ObservationFactoryImpl; import de.sekmi.histream.io.Streams; public class ITImportData { @Test public void importData() throws Exception{ Properties i2b2 = new Properties(); try( InputStream in = getClass().getResourceAsStream("/i2b2.properties") ){ i2b2.load(in); } PostgresPatientStore patients = new PostgresPatientStore((Map)i2b2); PostgresVisitStore visits = new PostgresVisitStore((Map)i2b2); I2b2Inserter inserter = new I2b2Inserter((Map)i2b2); ObservationFactory factory = new ObservationFactoryImpl(); factory.registerExtension(patients); factory.registerExtension(visits); ObservationSupplier data = ETLObservationSupplier.load(ETLObservationSupplier.class.getResource("/test-1-datasource.xml"), factory); inserter.setMeta(ObservationSupplier.META_ETL_STRATEGY, data.getMeta(ObservationSupplier.META_ETL_STRATEGY)); Supplier<Observation> source = data; // XXX test transformation later //source = new PullTransformer(source, mapping); try{ Streams.transfer(source, inserter); }catch( UncheckedIOException e ){ // unwrap unchecked IO exception throw e.getCause(); }finally{ data.close(); inserter.close(); patients.close(); visits.close(); } } } i2b2-integration-tests/src/test/java/de/sekmi/histream/i2b2/ITImportOntology.java 0 → 100644 +32 −0 Original line number Diff line number Diff line package de.sekmi.histream.i2b2; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URL; import java.sql.SQLException; import java.util.Map; import java.util.Properties; import org.junit.Test; import de.sekmi.histream.i2b2.ont.Import; import de.sekmi.histream.ontology.skos.Store; public class ITImportOntology { @Test public void importOntology() throws Exception{ Properties i2b2 = new Properties(); try( InputStream in = getClass().getResourceAsStream("/i2b2.properties") ){ i2b2.load(in); } Store store = new Store(new File("../histream-skos/examples/test-ontology.ttl")); try( Import i = new Import((Map)i2b2) ){ i.setOntology(store); i.processOntology(); } store.close(); } } i2b2-integration-tests/src/test/resources/i2b2.properties 0 → 100644 +25 −0 Original line number Diff line number Diff line jdbc.host = localhost jdbc.database = i2b2 jdbc.port = 15432 # all keys beginning with meta.jdbc. are passed to the JDBC driver meta.jdbc.user = i2b2metadata meta.jdbc.password = # metadata table meta.table=i2b2metadata.i2b2 # metadata table access meta.access=i2b2metadata.table_access meta.basepath=\\i2b2\\ # Before each import, data for this sourcesystem_cd will be deleted meta.sourcesystem_cd=test # concept dimension # all keys beginning with data.jdbc. are passed to the JDBC driver data.jdbc.user = i2b2demodata data.jdbc.password = data.concept.table=i2b2demodata.concept_dimension project = test # language to use for accessing ontology ont.language=EN Loading
i2b2-integration-tests/.gitignore 0 → 100644 +4 −0 Original line number Diff line number Diff line .settings/ .classpath .project target/
i2b2-integration-tests/pom.xml 0 → 100644 +62 −0 Original line number Diff line number Diff line <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <name>HIStream : i2b2 integration tests</name> <groupId>de.sekmi.histream</groupId> <artifactId>i2b2-intregration-tests</artifactId> <version>0.5-SNAPSHOT</version> <parent> <groupId>de.sekmi.histream</groupId> <artifactId>histream</artifactId> <version>0.5-SNAPSHOT</version> </parent> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18.1</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-i2b2</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-skos</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-import</artifactId> <version>0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>de.sekmi.histream</groupId> <artifactId>histream-import</artifactId> <version>0.5-SNAPSHOT</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18.1</version> <scope>test</scope> </dependency> </dependencies> </project> No newline at end of file
i2b2-integration-tests/src/test/java/de/sekmi/histream/i2b2/ITImportData.java 0 → 100644 +50 −0 Original line number Diff line number Diff line package de.sekmi.histream.i2b2; import java.io.InputStream; import java.io.UncheckedIOException; import java.util.Map; import java.util.Properties; import java.util.function.Supplier; import org.junit.Test; import de.sekmi.histream.Observation; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.etl.ETLObservationSupplier; import de.sekmi.histream.impl.ObservationFactoryImpl; import de.sekmi.histream.io.Streams; public class ITImportData { @Test public void importData() throws Exception{ Properties i2b2 = new Properties(); try( InputStream in = getClass().getResourceAsStream("/i2b2.properties") ){ i2b2.load(in); } PostgresPatientStore patients = new PostgresPatientStore((Map)i2b2); PostgresVisitStore visits = new PostgresVisitStore((Map)i2b2); I2b2Inserter inserter = new I2b2Inserter((Map)i2b2); ObservationFactory factory = new ObservationFactoryImpl(); factory.registerExtension(patients); factory.registerExtension(visits); ObservationSupplier data = ETLObservationSupplier.load(ETLObservationSupplier.class.getResource("/test-1-datasource.xml"), factory); inserter.setMeta(ObservationSupplier.META_ETL_STRATEGY, data.getMeta(ObservationSupplier.META_ETL_STRATEGY)); Supplier<Observation> source = data; // XXX test transformation later //source = new PullTransformer(source, mapping); try{ Streams.transfer(source, inserter); }catch( UncheckedIOException e ){ // unwrap unchecked IO exception throw e.getCause(); }finally{ data.close(); inserter.close(); patients.close(); visits.close(); } } }
i2b2-integration-tests/src/test/java/de/sekmi/histream/i2b2/ITImportOntology.java 0 → 100644 +32 −0 Original line number Diff line number Diff line package de.sekmi.histream.i2b2; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URL; import java.sql.SQLException; import java.util.Map; import java.util.Properties; import org.junit.Test; import de.sekmi.histream.i2b2.ont.Import; import de.sekmi.histream.ontology.skos.Store; public class ITImportOntology { @Test public void importOntology() throws Exception{ Properties i2b2 = new Properties(); try( InputStream in = getClass().getResourceAsStream("/i2b2.properties") ){ i2b2.load(in); } Store store = new Store(new File("../histream-skos/examples/test-ontology.ttl")); try( Import i = new Import((Map)i2b2) ){ i.setOntology(store); i.processOntology(); } store.close(); } }
i2b2-integration-tests/src/test/resources/i2b2.properties 0 → 100644 +25 −0 Original line number Diff line number Diff line jdbc.host = localhost jdbc.database = i2b2 jdbc.port = 15432 # all keys beginning with meta.jdbc. are passed to the JDBC driver meta.jdbc.user = i2b2metadata meta.jdbc.password = # metadata table meta.table=i2b2metadata.i2b2 # metadata table access meta.access=i2b2metadata.table_access meta.basepath=\\i2b2\\ # Before each import, data for this sourcesystem_cd will be deleted meta.sourcesystem_cd=test # concept dimension # all keys beginning with data.jdbc. are passed to the JDBC driver data.jdbc.user = i2b2demodata data.jdbc.password = data.concept.table=i2b2demodata.concept_dimension project = test # language to use for accessing ontology ont.language=EN