Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rod i github-admin, så det tidligere pushede tilsyneladende er væk. P…

…ush igen
  • Loading branch information...
commit 0d576ad4c9e3788b97cc8606fca0a69775c58461 0 parents
@jrftrifork jrftrifork authored
Showing with 14,855 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +99 −0 pom.xml
  3. +23 −0 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserApplicationConfig.java
  4. +21 −0 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserInfrastructureConfig.java
  5. +16 −0 src/main/java/dk/nsi/sdm4/dosering/config/WebConfig.java
  6. +49 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageRecord.java
  7. +126 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageStructure.java
  8. +72 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageUnit.java
  9. +79 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageVersion.java
  10. +69 −0 src/main/java/dk/nsi/sdm4/dosering/model/Drug.java
  11. +86 −0 src/main/java/dk/nsi/sdm4/dosering/model/DrugDosageStructureRelation.java
  12. +244 −0 src/main/java/dk/nsi/sdm4/dosering/parser/DoseringParser.java
  13. +8 −0 src/main/resources/db/migration/V20120828_1342__Dosering_ImporterStatus.sql
  14. +92 −0 src/main/resources/db/migration/V20120828_1343__Dosering_Tables.sql
  15. +3 −0  src/main/resources/default-config.properties
  16. +38 −0 src/main/webapp/WEB-INF/web.xml
  17. +11 −0 src/test/java/dk/nsi/sdm4/dosering/integrationtest/DoseringimporterIsUpIT.java
  18. +194 −0 src/test/java/dk/nsi/sdm4/dosering/parser/DoseringParserIntegrationTest.java
  19. +589 −0 src/test/resources/data/doseringsforslag/multiple/DosageStructures.json
  20. +23 −0 src/test/resources/data/doseringsforslag/multiple/DosageUnits.json
  21. +1 −0  src/test/resources/data/doseringsforslag/multiple/DosageVersion.json
  22. +3,712 −0 src/test/resources/data/doseringsforslag/multiple/Drugs.json
  23. +9,281 −0 src/test/resources/data/doseringsforslag/multiple/DrugsDosageStructures.json
  24. +3 −0  src/test/resources/data/doseringsforslag/single/DosageStructures.json
  25. +3 −0  src/test/resources/data/doseringsforslag/single/DosageUnits.json
  26. +1 −0  src/test/resources/data/doseringsforslag/single/DosageVersion.json
  27. +1 −0  src/test/resources/data/doseringsforslag/single/Drugs.json
  28. +3 −0  src/test/resources/data/doseringsforslag/single/DrugsDosageStructures.json
  29. +5 −0 src/test/resources/log4j.properties
  30. +2 −0  src/test/resources/test.properties
1  .gitignore
@@ -0,0 +1 @@
+target
99 pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <parent>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>sdm-parent</artifactId>
+ <version>4.1</version>
+ </parent>
+
+ <artifactId>doseringimporter</artifactId>
+ <packaging>war</packaging>
+ <version>4.1-SNAPSHOT</version>
+
+ <scm>
+ <url>scm:git:git@github.com:trifork/sdm4-doseringimporter</url>
+ <connection>scm:git:git@github.com:trifork/sdm4-doseringimporter.git</connection>
+ <developerConnection>scm:git:git@github.com:trifork/sdm4-doseringimporter.git</developerConnection>
+ </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://jira.trifork.com/</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://ci02.trifork.com:8443/view/SDM4/job/SDM4-doseringimporter/</url>
+ </ciManagement>
+
+ <prerequisites>
+ <maven>3.0.0</maven>
+ </prerequisites>
+
+ <distributionManagement>
+ <repository>
+ <id>Trifork-Nexus-Release-Repository</id>
+ <name>Trifork Nexus Release Repository</name>
+ <url>https://nexus.trifork.com/content/repositories/releases/</url>
+ </repository>
+ </distributionManagement>
+
+ <repositories>
+ <repository>
+ <id>Trifork-Nexus-Public-Repository</id>
+ <name>Trifork Nexus Public Repository</name>
+ <url>https://nexus.trifork.com/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>Trifork-Nexus-Public-Repository</id>
+ <name>Trifork Nexus Public Repository</name>
+ <url>https://nexus.trifork.com/content/groups/public/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>sdm-core</artifactId>
+ <version>4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>testutils</artifactId>
+ <version>4.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
23 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserApplicationConfig.java
@@ -0,0 +1,23 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.parser.Parser;
+import dk.nsi.sdm4.core.persistence.AuditingPersister;
+import dk.nsi.sdm4.core.persistence.Persister;
+import dk.nsi.sdm4.dosering.parser.DoseringParser;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+// The Spring Java Configuration annotations above needs to be on this class, not on the abstract superclass to
+// make Spring stop complaining about weird things
+public class DoseringparserApplicationConfig {
+ @Bean
+ public Parser parser() {
+ return new DoseringParser();
+ }
+
+ @Bean
+ public Persister persister() {
+ return new AuditingPersister();
+ }
+}
21 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserInfrastructureConfig.java
@@ -0,0 +1,21 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.config.StamdataConfiguration;
+import dk.sdsd.nsp.slalog.api.SLALogConfig;
+import dk.sdsd.nsp.slalog.api.SLALogger;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableScheduling
+@EnableTransactionManagement
+//The Spring Java Configuration annotations above needs to be on this class, not on the abstract superclass to
+// make Spring stop complaining about weird things
+public class DoseringparserInfrastructureConfig extends StamdataConfiguration {
+ @Bean
+ public SLALogger slaLogger() {
+ return new SLALogConfig("Stamdata Dosering-importer", "doseringimporter").getSLALogger();
+ }
+}
16 src/main/java/dk/nsi/sdm4/dosering/config/WebConfig.java
@@ -0,0 +1,16 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.status.StatusReporter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+@Configuration
+@EnableWebMvc
+public class WebConfig {
+
+ @Bean
+ public StatusReporter statusReporter() {
+ return new StatusReporter();
+ }
+}
49 src/main/java/dk/nsi/sdm4/dosering/model/DosageRecord.java
@@ -0,0 +1,49 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+package dk.nsi.sdm4.dosering.model;
+
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+import dk.nsi.sdm4.core.domain.AbstractStamdataEntity;
+
+public abstract class DosageRecord extends AbstractStamdataEntity {
+
+ private Date validFrom;
+ private static final Logger logger = Logger.getLogger(DosageRecord.class);
+
+ public void setVersion(Date validFrom) {
+
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Date getValidFrom() {
+
+ return validFrom;
+ }
+}
126 src/main/java/dk/nsi/sdm4/dosering/model/DosageStructure.java
@@ -0,0 +1,126 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Arrays;
+import java.util.Collections;
+
+@Entity
+public class DosageStructure extends DosageRecord
+{
+ // Reference til releaseNumber i Version. Obligatorisk. Heltal, 15 cifre.
+ private long releaseNumber;
+
+ // Unik kode for doseringstrukturen. Obligatorisk. Heltal, 11 cifre.
+ private long code;
+
+ // Typen af dosering, enten "M+M+A+N", "PN", "N daglig",
+ // "Fritekst" eller "Kompleks". Obligatorisk. Streng, 100 tegn.
+ private String type;
+
+ // For simple typer (dvs. alt andet end "Kompleks")
+ // indeholder feltet doseringen på simpel form. Optionelt. Streng, 100 tegn.
+ private String simpleString;
+
+ // For simple typer en eventuel supplerende tekst.
+ // Optionelt. Streng, 200 tegn.
+ private String supplementaryText;
+
+ // FMKs strukturerede dosering i XML format. Bemærk at enkelte
+ // værdier vil være escaped. Obligatorisk. Streng, 10000 tegn.
+ private String xml;
+
+ // Såfremt det er muligt at lave en kort
+ // doseringstekst på baggrund af xml og lægemidlets doseringsenhed vil
+ // dette felt indeholde denne. Optionelt. Streng, 70 tegn.
+ private String shortTranslation;
+
+ // En lang doseringstekst baggrund af xml og
+ // lægemidlets doseringsenhed. Obligatorisk. Strengm 10000 tegn.
+ // TODO: While this is marked as (Mandatory) in practice it is
+ // sometimes null. This will change in future. (Tom K)
+ private String longTranslation;
+
+ @Column
+ public long getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+
+ @Id
+ @Column
+ public long getCode()
+ {
+ return code;
+ }
+
+ @Column
+ public String getType()
+ {
+ return type;
+ }
+
+ @Column
+ public String getSimpleString()
+ {
+ return simpleString;
+ }
+
+ @Column
+ public String getSupplementaryText()
+ {
+ return supplementaryText;
+ }
+
+ @Column
+ public String getXml()
+ {
+ return xml;
+ }
+
+ @Column
+ public String getShortTranslation()
+ {
+ return shortTranslation;
+ }
+
+ @Column
+ public String getLongTranslation()
+ {
+ return longTranslation;
+ }
+
+ public String toString() {
+ return new ReflectionToStringBuilder(this).setExcludeFieldNames(new String[] {"xml"}).toString();
+ }
+}
72 src/main/java/dk/nsi/sdm4/dosering/model/DosageUnit.java
@@ -0,0 +1,72 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class DosageUnit extends DosageRecord
+{
+ // Reference til releaseNumber i Version. Obligatorisk. Heltal, 15 cifre.
+ private long releaseNumber;
+
+ // Unik kode for doseringsenheden. Obligatorisk. Heltal, 4 cifre.
+ private int code;
+
+ // Doseringenhedens tekst i ental. Obligatorisk. Streng, 100 tegn.
+ private String textSingular;
+
+ // Doseringsenhedens tekst i flertal. Obligatorisk. Streng, 100 tegn.
+ private String textPlural;
+
+ @Id
+ @Column
+ public int getCode()
+ {
+ return code;
+ }
+
+ @Column
+ public long getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+
+ @Column
+ public String getTextSingular()
+ {
+ return textSingular;
+ }
+
+ @Column
+ public String getTextPlural()
+ {
+ return textPlural;
+ }
+}
79 src/main/java/dk/nsi/sdm4/dosering/model/DosageVersion.java
@@ -0,0 +1,79 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+
+@Entity
+public class DosageVersion extends DosageRecord
+{
+ // daDate: Dato for Apotekerforeningens mærkevaretakst, som datasættet er
+ // udarbejdet på baggrund af. Obligatorisk. Dato, yyyy-MM-dd.
+ protected Date daDate;
+
+ // lmsDate: Dato for Lægemiddelstyrelsens takst, som datasættet er
+ // udarbejdet på baggrund af. Obligatorisk. Dato, yyyy-MM-dd.
+ protected Date lmsDate;
+
+ // Dato filen er released. Obligatorisk. Dato, yyyy-MM-dd.
+ protected Date releaseDate;
+
+ // Unikt release nummer. Obligatorisk. Heltal, 15 cifre.
+ protected long releaseNumber;
+
+ @Column
+ public Date getDaDate()
+ {
+
+ return daDate;
+ }
+
+ @Column
+ public Date getLmsDate()
+ {
+
+ return lmsDate;
+ }
+
+ @Id
+ @Column
+ public Date getReleaseDate()
+ {
+ return releaseDate;
+ }
+
+ @Column
+ public long getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+}
69 src/main/java/dk/nsi/sdm4/dosering/model/Drug.java
@@ -0,0 +1,69 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name = "DosageDrug")
+public class Drug extends DosageRecord
+{
+ private long drugId;
+ private int releaseNumber;
+ private String drugName;
+ private int dosageUnitCode;
+
+ protected Drug()
+ {
+ }
+
+ @Id
+ @Column
+ public long getDrugId()
+ {
+ return drugId;
+ }
+
+ @Column
+ public int getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+
+ @Column
+ public String getDrugName()
+ {
+ return drugName;
+ }
+
+ @Column
+ public int getDosageUnitCode()
+ {
+ return dosageUnitCode;
+ }
+}
86 src/main/java/dk/nsi/sdm4/dosering/model/DrugDosageStructureRelation.java
@@ -0,0 +1,86 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class DrugDosageStructureRelation extends DosageRecord
+{
+ // Reference til releaseNumber i Version. Obligatorisk. Heltal, 15 cifre.
+ private long releaseNumber;
+
+ // Lægemidlets drug id. Reference til drugId i drugs. Obligatorisk. Heltal,
+ // 11 cifre.
+ private long drugId;
+
+ // Reference til code i dosageStructure. Obligatorisk. Heltal, 11 cifre.
+ private long dosageStructureCode;
+
+ public void setReleaseNumber(long releaseNumber)
+ {
+
+ this.releaseNumber = releaseNumber;
+ }
+
+ @Id
+ @Column
+ public String getId()
+ {
+ return Long.toString(drugId) + Long.toString(dosageStructureCode);
+ }
+
+ @Column
+ public long getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+
+ public void setDrugId(long drugId)
+ {
+ this.drugId = drugId;
+ }
+
+ @Column
+ public long getDrugId()
+ {
+ return drugId;
+ }
+
+ public void setDosageStructureCode(long dosageStructureCode)
+ {
+ this.dosageStructureCode = dosageStructureCode;
+ }
+
+ @Column
+ public long getDosageStructureCode()
+ {
+ return dosageStructureCode;
+ }
+}
244 src/main/java/dk/nsi/sdm4/dosering/parser/DoseringParser.java
@@ -0,0 +1,244 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.reflect.Type;
+import java.nio.charset.Charset;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import dk.nsi.sdm4.core.domain.CompleteDataset;
+import dk.nsi.sdm4.core.domain.TemporalEntity;
+import dk.nsi.sdm4.core.parser.Parser;
+import dk.nsi.sdm4.core.parser.ParserException;
+import dk.nsi.sdm4.core.persistence.Persister;
+import dk.nsi.sdm4.core.util.Dates;
+import dk.nsi.sdm4.dosering.model.DosageRecord;
+import dk.nsi.sdm4.dosering.model.DosageStructure;
+import dk.nsi.sdm4.dosering.model.DosageUnit;
+import dk.nsi.sdm4.dosering.model.DosageVersion;
+import dk.nsi.sdm4.dosering.model.Drug;
+import dk.nsi.sdm4.dosering.model.DrugDosageStructureRelation;
+import dk.sdsd.nsp.slalog.api.SLALogItem;
+import dk.sdsd.nsp.slalog.api.SLALogger;
+
+/**
+ * Importer for drug dosage suggestions data.
+ */
+public class DoseringParser implements Parser {
+ private static final Logger logger = Logger.getLogger(DoseringParser.class);
+
+ @Autowired
+ SLALogger slaLogger;
+
+ @Autowired
+ Persister persister;
+
+ @Autowired
+ JdbcTemplate jdbcTemplate;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void process(File dataSet) throws ParserException {
+
+ SLALogItem slaLogItem = slaLogger.createLogItem("DosageSuggestionImporter", "All Files");
+ try {
+ // First check to see if all expected files are present
+ validateInputStructure(dataSet);
+
+ // METADATA FILE
+ //
+ // The file contains information about the validity period
+ // of the data.
+
+ DosageVersion version = parseVersionFile(getFile(dataSet, "DosageVersion.json"));
+ version.setVersion(version.getReleaseDate());
+ CompleteDataset<DosageVersion> versionDataset = new CompleteDataset<DosageVersion>(DosageVersion.class, version.getValidFrom(), Dates.THE_END_OF_TIME);
+ versionDataset.add(version);
+
+ // CHECK PREVIOUS VERSION
+ //
+ // Check that the version in imported in
+ // sequence and that we haven't missed one.
+ int maxVersion = jdbcTemplate.queryForInt("SELECT MAX(releaseNumber) FROM DosageVersion");
+
+ if (maxVersion == 0) {
+ logger.warn("No previous version of Dosage Suggestion registry found, assuming initial import.");
+ } else if (version.getReleaseNumber() != maxVersion + 1) {
+ throw new Exception("The Dosage Suggestion files are out of sequence! Expected " + (maxVersion + 1) + ", but was " + version.getReleaseNumber() + ".");
+ }
+
+
+ // OTHER FILES
+ //
+ // There are data files and relation file.
+ // Relation files act as one-to-one etc. relations.
+ //
+ // This data source represents the 'whole truth' for
+ // the validity period. That means that complete
+ // datasets will be used for persisting, and no existing
+ // records will be valid in the period.
+ //
+ // We have to declare the <T> types explicitly since GSon
+ // (Java is stupid) can't get the runtime types otherwise.
+
+ Type type;
+
+ type = new TypeToken<Map<String, Collection<Drug>>>() {
+ }.getType();
+ CompleteDataset<?> drugs = parseDataFile(getFile(dataSet, "Drugs.json"), "drugs", version, Drug.class, type);
+ setValidityPeriod(drugs, version);
+
+ type = new TypeToken<Map<String, Collection<DosageUnit>>>() {
+ }.getType();
+ CompleteDataset<?> units = parseDataFile(getFile(dataSet, "DosageUnits.json"), "dosageUnits", version, DosageUnit.class, type);
+ setValidityPeriod(units, version);
+
+ type = new TypeToken<Map<String, Collection<DosageStructure>>>() {
+ }.getType();
+ CompleteDataset<?> structures = parseDataFile(getFile(dataSet, "DosageStructures.json"), "dosageStructures", version, DosageStructure.class, type);
+ setValidityPeriod(structures, version);
+
+ type = new TypeToken<Map<String, Collection<DrugDosageStructureRelation>>>() {
+ }.getType();
+ CompleteDataset<?> relations = parseDataFile(getFile(dataSet, "DrugsDosageStructures.json"), "drugsDosageStructures", version, DrugDosageStructureRelation.class, type);
+ setValidityPeriod(relations, version);
+
+ // PERSIST THE DATA
+ persister.persistCompleteDataset(versionDataset, drugs, structures, units, relations);
+
+ logger.info("Dosage Suggestion Registry v" + version.getReleaseNumber() + " was successfully imported.");
+ slaLogItem.setCallResultOk();
+ slaLogItem.store();
+ } catch (Exception e) {
+ slaLogItem.setCallResultError("DosageSuggestionImporter failed - Cause: " + e.getMessage());
+ slaLogItem.store();
+ throw new ParserException(e);
+ }
+ }
+
+ /**
+ * Parses Version.json files.
+ */
+ private DosageVersion parseVersionFile(File file) throws FileNotFoundException {
+ Reader reader = new InputStreamReader(new FileInputStream(file));
+
+ Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
+ Type type = new TypeToken<Map<String, DosageVersion>>() {
+ }.getType();
+
+ Map<String, DosageVersion> versions = gson.fromJson(reader, type);
+
+ return versions.get("version");
+ }
+
+ /**
+ * Parses other data files.
+ */
+ private <T extends TemporalEntity> CompleteDataset<T> parseDataFile(File file, String root, DosageVersion version, Class<T> type, Type collectionType) throws FileNotFoundException {
+ Reader reader = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"));
+
+ Map<String, List<T>> parsedData = new Gson().fromJson(reader, collectionType);
+
+ CompleteDataset<T> dataset = new CompleteDataset<T>(type, version.getValidFrom(), version.getValidTo());
+
+ for (T structure : parsedData.get(root)) {
+ dataset.add(structure);
+ }
+
+ return dataset;
+ }
+
+ /**
+ * HACK: These dates should be taken from the complete data set. There is no
+ * reason why we set dates on each record.
+ */
+ @SuppressWarnings("unchecked")
+ private void setValidityPeriod(CompleteDataset<?> dataset, DosageVersion version) {
+ CompleteDataset<? extends DosageRecord> records = (CompleteDataset<? extends DosageRecord>) dataset;
+
+ for (DosageRecord record : records.getEntities()) {
+ record.setVersion(version.getValidFrom());
+ }
+ }
+
+ public boolean validateInputStructure(File input) {
+ boolean present = true;
+
+ present &= getFile(input, "DosageStructures.json") != null;
+ present &= getFile(input, "DosageUnits.json") != null;
+ present &= getFile(input, "Drugs.json") != null;
+ present &= getFile(input, "DrugsDosageStructures.json") != null;
+ present &= getFile(input, "DosageVersion.json") != null;
+
+ return present;
+ }
+
+ /**
+ * Searches the provided file array for a specific file name.
+ *
+ * @param files the list of files to search.
+ * @param name the file name of the file to return.
+ * @return the file with the specified name or null if no file is found.
+ */
+ private File getFile(File dataSet, String name) {
+
+ File[] files = dataSet.listFiles();
+
+ File result = null;
+
+ for (File file : files) {
+
+ if (file.getName().equals(name)) {
+ result = file;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getHome() {
+ return "doseringimporter";
+ }
+
+}
8 src/main/resources/db/migration/V20120828_1342__Dosering_ImporterStatus.sql
@@ -0,0 +1,8 @@
+CREATE TABLE doseringimporterImportStatus (
+ Id BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ StartTime DATETIME NOT NULL,
+ EndTime DATETIME,
+ Outcome VARCHAR(20),
+
+ INDEX (StartTime)
+);
92 src/main/resources/db/migration/V20120828_1343__Dosering_Tables.sql
@@ -0,0 +1,92 @@
+CREATE TABLE DosageStructure (
+ DosageStructurePID BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+
+ releaseNumber BIGINT(15) NOT NULL,
+
+ code VARCHAR(11) NOT NULL, -- ID
+ type VARCHAR(100) NOT NULL,
+ simpleString VARCHAR(100), -- OPTIONAL
+ supplementaryText VARCHAR(200), -- OPTIONAL
+ xml VARCHAR(10000) NOT NULL,
+ shortTranslation VARCHAR(70),
+ longTranslation VARCHAR(10000), -- OPTIONAL (The specs say it cannot be NULL. See comment in DosageStructure.java)
+ ModifiedDate DATETIME NOT NULL,
+ ValidFrom DATETIME NOT NULL,
+ ValidTo DATETIME NOT NULL,
+ CreatedDate DATETIME NOT NULL,
+
+ INDEX (DosageStructurePID, ModifiedDate),
+ INDEX (code, ValidTo, ValidFrom)
+) ENGINE=InnoDB COLLATE=utf8_bin;
+
+CREATE TABLE DosageUnit (
+ DosageUnitPID BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+
+ code INT(4) NOT NULL, -- ID
+
+ releaseNumber BIGINT(15) NOT NULL,
+ textSingular VARCHAR(100) NOT NULL,
+ textPlural VARCHAR(100) NOT NULL,
+
+ ModifiedDate DATETIME NOT NULL,
+ ValidFrom DATETIME NOT NULL,
+ ValidTo DATETIME NOT NULL,
+ CreatedDate DATETIME NOT NULL,
+
+ INDEX (DosageUnitPID, ModifiedDate),
+ INDEX (code, ValidTo, ValidFrom)
+) ENGINE=InnoDB COLLATE=utf8_bin;
+
+CREATE TABLE DosageVersion (
+ DosageVersionPID BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+
+ daDate DATE NOT NULL, -- @ID // TODO: Should the id not be the releaseNumber? :S
+
+ lmsDate DATE NOT NULL,
+ releaseDate DATE NOT NULL,
+ releaseNumber BIGINT(15) NOT NULL,
+
+ ModifiedDate DATETIME NOT NULL,
+ ValidFrom DATETIME NOT NULL,
+ ValidTo DATETIME NOT NULL,
+ CreatedDate DATETIME NOT NULL,
+
+ INDEX (DosageVersionPID, ModifiedDate),
+ INDEX (releaseDate, ValidTo, ValidFrom)
+) ENGINE=InnoDB COLLATE=utf8_bin;
+
+CREATE TABLE DrugDosageStructureRelation (
+ DrugDosageStructureRelationPID BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+
+ id VARCHAR(200) NOT NULL,
+
+ drugId BIGINT(11) NOT NULL,
+ dosageStructureCode BIGINT(11) NOT NULL,
+ releaseNumber BIGINT(15) NOT NULL,
+
+ ModifiedDate DATETIME NOT NULL,
+ ValidFrom DATETIME NOT NULL,
+ ValidTo DATETIME NOT NULL,
+ CreatedDate DATETIME NOT NULL,
+
+ INDEX (DrugDosageStructureRelationPID, ModifiedDate),
+ INDEX (id, ValidTo, ValidFrom)
+) ENGINE=InnoDB COLLATE=utf8_bin;
+
+CREATE TABLE DosageDrug (
+ DosageDrugPID BIGINT(15) AUTO_INCREMENT NOT NULL PRIMARY KEY,
+
+ releaseNumber BIGINT(15) NOT NULL,
+
+ drugId BIGINT(11) NOT NULL,
+ dosageUnitCode BIGINT(11) NOT NULL,
+ drugName VARCHAR(200) NOT NULL,
+
+ ModifiedDate DATETIME NOT NULL,
+ ValidFrom DATETIME NOT NULL,
+ ValidTo DATETIME NOT NULL,
+ CreatedDate DATETIME NOT NULL,
+
+ INDEX (DosageDrugPID, ModifiedDate),
+ INDEX (drugId, ValidTo, ValidFrom)
+) ENGINE=InnoDB COLLATE=utf8_bin;
3  src/main/resources/default-config.properties
@@ -0,0 +1,3 @@
+spooler.max.days.between.runs=95
+jdbc.JNDIName=java:/SDMDS
+sdm.dataDir=/pack/jboss/domain/data/sdm4
38 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <display-name>SDM Dosering Importer</display-name>
+
+ <context-param>
+ <param-name>contextClass</param-name>
+ <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>dk.nsi.sdm4.dosering.config</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>appServlet</servlet-name>
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+ <init-param>
+ <param-name>contextConfigLocation</param-name>
+ <!--suppress WebProperties -->
+ <param-value/>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>appServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
11 src/test/java/dk/nsi/sdm4/dosering/integrationtest/DoseringimporterIsUpIT.java
@@ -0,0 +1,11 @@
+package dk.nsi.sdm4.dosering.integrationtest;
+
+import dk.nsi.sdm4.testutils.StatuspageChecker;
+import org.junit.Test;
+
+public class DoseringimporterIsUpIT {
+ @Test
+ public void statusPageReturns200OK() throws Exception {
+ new StatuspageChecker().assertThatStatuspageReturns200OK("doseringimporter");
+ }
+}
194 src/test/java/dk/nsi/sdm4/dosering/parser/DoseringParserIntegrationTest.java
@@ -0,0 +1,194 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+package dk.nsi.sdm4.dosering.parser;
+
+import dk.nsi.sdm4.core.persistence.Persister;
+import dk.nsi.sdm4.dosering.config.DoseringparserApplicationConfig;
+import dk.nsi.sdm4.testutils.TestDbConfiguration;
+import org.apache.commons.io.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.apache.commons.io.FileUtils.toFile;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@Transactional
+@ContextConfiguration(classes = {DoseringparserApplicationConfig.class, TestDbConfiguration.class})
+public class DoseringParserIntegrationTest {
+ @Rule
+ public TemporaryFolder tmpDir = new TemporaryFolder();
+
+ @Autowired
+ DoseringParser parser;
+
+ @Autowired
+ JdbcTemplate jdbcTemplate;
+
+ @Autowired
+ Persister persister;
+
+ private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+ private File versionFile;
+ private File drugsFile;
+ private File dosageStructureFile;
+ private File unitsFile;
+ private File relationFile;
+
+ @Before
+ public void setUp() throws SQLException {
+ // The 'single' files only contain one record each.
+ // This makes it easy to know that is imported and
+ // it is a lot faster.
+ //
+ // The other files contain several records and are
+ // used to count the number of records imported.
+
+ versionFile = getFile("single/DosageVersion.json");
+ drugsFile = getFile("single/Drugs.json");
+ dosageStructureFile = getFile("single/DosageStructures.json");
+ unitsFile = getFile("single/DosageUnits.json");
+ relationFile = getFile("single/DrugsDosageStructures.json");
+ }
+
+ @Test
+ public void importTheVersionFileCorrectly() throws Exception {
+ runImporter();
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select * from DosageVersion");
+ rs.next();
+
+ assertThat(rs.getLong("releaseNumber"), equalTo(125L));
+ assertThat(rs.getDate("releaseDate"), equalTo(date("2011-02-15")));
+ assertThat(rs.getDate("lmsDate"), equalTo(date("2011-02-02")));
+ assertThat(rs.getDate("daDate"), equalTo(date("2011-01-24")));
+
+ // expect only one row
+ assertFalse(rs.next());
+ }
+
+ @Test
+ public void importAllDosageStructures() throws Exception {
+ dosageStructureFile = getFile("multiple/DosageStructures.json");
+
+ runImporter();
+
+ assertThat(jdbcTemplate.queryForInt("select count(*) from DosageStructure"), equalTo(587));
+ }
+
+ @Test
+ public void importTheStructuresCorrectly() throws Exception {
+ runImporter();
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select * from DosageStructure");
+ rs.next();
+
+ assertThat(rs.getLong("releaseNumber"), equalTo(125L));
+ assertThat(rs.getString("code"), equalTo("3"));
+ assertThat(rs.getString("type"), equalTo("M+M+A+N"));
+ assertThat(rs.getString("simpleString"), equalTo("0.5"));
+ assertThat(rs.getString("shortTranslation"), equalTo("1/2 tablet morgen"));
+ assertThat(rs.getString("xml"), equalTo("<b:DosageStructure\n xsi:schemaLocation=\"http://www.dkma.dk/medicinecard/xml.schema/2009/01/01 DKMA_DosageStructure.xsd\"\n xmlns:a=\"http://www.dkma.dk/medicinecard/xml.schema/2008/06/01\"\n xmlns:b=\"http://www.dkma.dk/medicinecard/xml.schema/2009/01/01\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <b:DosageTimesStructure>\n <a:DosageTimesIterationIntervalQuantity>1</a:DosageTimesIterationIntervalQuantity>\n <a:DosageTimesStartDate>2000-01-01</a:DosageTimesStartDate>\n <b:DosageQuantityUnitText>tablet</b:DosageQuantityUnitText>\n <b:DosageDayElementStructure>\n <a:DosageDayIdentifier>1</a:DosageDayIdentifier>\n <b:MorningDosageTimeElementStructure>\n <a:DosageQuantityValue>0.5</a:DosageQuantityValue>\n </b:MorningDosageTimeElementStructure>\n </b:DosageDayElementStructure>\n </b:DosageTimesStructure>\n</b:DosageStructure>"));
+ assertThat(rs.getString("longTranslation"), equalTo("Daglig 1/2 tablet morgen"));
+ assertThat(rs.getString("supplementaryText"), nullValue());
+
+ // expect only one row
+ assertFalse(rs.next());
+ }
+
+ @Test
+ public void Should_import_all_dosage_units() throws Exception {
+ unitsFile = getFile("multiple/DosageUnits.json");
+
+ runImporter();
+ assertThat(jdbcTemplate.queryForInt("select count(*) from DosageUnit"), equalTo(21));
+ }
+
+ @Test
+ public void Should_import_dosage_units_correctly() throws Exception {
+ runImporter();
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet("select * from DosageUnit");
+ rs.next();
+
+ assertThat(rs.getLong("releaseNumber"), equalTo(125L));
+ assertThat(rs.getInt("code"), equalTo(8));
+ assertThat(rs.getString("textSingular"), equalTo("brusetablet"));
+ assertThat(rs.getString("textPlural"), equalTo("brusetabletter"));
+
+ // expect only one row
+ assertFalse(rs.next());
+
+ }
+
+ @Test
+ public void Should_import_all_drugs() throws Exception {
+ drugsFile = getFile("multiple/Drugs.json");
+
+ runImporter();
+ assertThat(jdbcTemplate.queryForInt("select count(*) from DosageDrug"), equalTo(3710));
+
+ }
+
+ // HELPER METHODS
+
+ private Date date(String dateString) throws Exception {
+ return dateFormat.parse(dateString);
+ }
+
+ public File getFile(String filename) {
+ return toFile(getClass().getClassLoader().getResource("data/doseringsforslag/" + filename));
+ }
+
+ public void runImporter() throws Exception {
+ File datasetDir = tmpDir.newFolder();
+ FileUtils.copyFileToDirectory(versionFile, datasetDir);
+ FileUtils.copyFileToDirectory(drugsFile, datasetDir);
+ FileUtils.copyFileToDirectory(dosageStructureFile, datasetDir);
+ FileUtils.copyFileToDirectory(unitsFile, datasetDir);
+ FileUtils.copyFileToDirectory(relationFile, datasetDir);
+
+ parser.process(datasetDir);
+ }
+}
589 src/test/resources/data/doseringsforslag/multiple/DosageStructures.json
589 additions, 0 deletions not shown
23 src/test/resources/data/doseringsforslag/multiple/DosageUnits.json
@@ -0,0 +1,23 @@
+{"dosageUnits":[
+ {"releaseNumber":125,"code":8,"textSingular":"brusetablet","textPlural":"brusetabletter"},
+ {"releaseNumber":125,"code":14,"textSingular":"dråbe","textPlural":"dråber"},
+ {"releaseNumber":125,"code":21,"textSingular":"kapsel","textPlural":"kapsler"},
+ {"releaseNumber":125,"code":24,"textSingular":"klysma","textPlural":"klysma"},
+ {"releaseNumber":125,"code":28,"textSingular":"ml","textPlural":"ml"},
+ {"releaseNumber":125,"code":38,"textSingular":"plaster","textPlural":"plastre"},
+ {"releaseNumber":125,"code":40,"textSingular":"pulver","textPlural":"pulvere"},
+ {"releaseNumber":125,"code":41,"textSingular":"pust","textPlural":"pust"},
+ {"releaseNumber":125,"code":42,"textSingular":"resoriblet","textPlural":"resoribletter"},
+ {"releaseNumber":125,"code":50,"textSingular":"sug","textPlural":"sug"},
+ {"releaseNumber":125,"code":51,"textSingular":"sugetablet","textPlural":"sugetabletter"},
+ {"releaseNumber":125,"code":52,"textSingular":"suppositorie","textPlural":"suppositorier"},
+ {"releaseNumber":125,"code":53,"textSingular":"tablet","textPlural":"tabletter"},
+ {"releaseNumber":125,"code":55,"textSingular":"tyggegummi","textPlural":"tyggegummi"},
+ {"releaseNumber":125,"code":56,"textSingular":"tyggetablet","textPlural":"tyggetabletter"},
+ {"releaseNumber":125,"code":60,"textSingular":"vaginalkapsel","textPlural":"vaginalkapsler"},
+ {"releaseNumber":125,"code":61,"textSingular":"vagitorie","textPlural":"vagitorier"},
+ {"releaseNumber":125,"code":81,"textSingular":"smeltetablet","textPlural":"smeltetabletter"},
+ {"releaseNumber":125,"code":1001,"textSingular":"dosis","textPlural":"doser"},
+ {"releaseNumber":125,"code":1002,"textSingular":"anvendelse","textPlural":"anvendelser"},
+ {"releaseNumber":125,"code":1003,"textSingular":"udvortes behandling","textPlural":"udvortes behandlinger"}
+]}
1  src/test/resources/data/doseringsforslag/multiple/DosageVersion.json
@@ -0,0 +1 @@
+{ "version": {"releaseNumber":125,"releaseDate":"2011-02-15","lmsDate":"2011-02-02","daDate":"2011-01-24"}}
3,712 src/test/resources/data/doseringsforslag/multiple/Drugs.json
3,712 additions, 0 deletions not shown
9,281 src/test/resources/data/doseringsforslag/multiple/DrugsDosageStructures.json
9,281 additions, 0 deletions not shown
3  src/test/resources/data/doseringsforslag/single/DosageStructures.json
@@ -0,0 +1,3 @@
+{"dosageStructures":[
+ {"releaseNumber":125,"code":3,"hashKey":"M+M+A+N/0.5/tablet/","type":"M+M+A+N","simpleString":"0.5","xml":"<b:DosageStructure\n xsi:schemaLocation=\"http://www.dkma.dk/medicinecard/xml.schema/2009/01/01 DKMA_DosageStructure.xsd\"\n xmlns:a=\"http://www.dkma.dk/medicinecard/xml.schema/2008/06/01\"\n xmlns:b=\"http://www.dkma.dk/medicinecard/xml.schema/2009/01/01\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <b:DosageTimesStructure>\n <a:DosageTimesIterationIntervalQuantity>1</a:DosageTimesIterationIntervalQuantity>\n <a:DosageTimesStartDate>2000-01-01</a:DosageTimesStartDate>\n <b:DosageQuantityUnitText>tablet</b:DosageQuantityUnitText>\n <b:DosageDayElementStructure>\n <a:DosageDayIdentifier>1</a:DosageDayIdentifier>\n <b:MorningDosageTimeElementStructure>\n <a:DosageQuantityValue>0.5</a:DosageQuantityValue>\n </b:MorningDosageTimeElementStructure>\n </b:DosageDayElementStructure>\n </b:DosageTimesStructure>\n</b:DosageStructure>","shortTranslation":"1/2 tablet morgen","longTranslation":"Daglig 1/2 tablet morgen"}
+]}
3  src/test/resources/data/doseringsforslag/single/DosageUnits.json
@@ -0,0 +1,3 @@
+{"dosageUnits":[
+ {"releaseNumber":125,"code":8,"textSingular":"brusetablet","textPlural":"brusetabletter"}
+]}
1  src/test/resources/data/doseringsforslag/single/DosageVersion.json
@@ -0,0 +1 @@
+{ "version": {"releaseNumber":125,"releaseDate":"2011-02-15","lmsDate":"2011-02-02","daDate":"2011-01-24"}}
1  src/test/resources/data/doseringsforslag/single/Drugs.json
@@ -0,0 +1 @@
+{"drugs":[{"releaseNumber":125,"drugId":28100009555,"dosageUnitCode":53,"drugName":"Kemadrin"}]}
3  src/test/resources/data/doseringsforslag/single/DrugsDosageStructures.json
@@ -0,0 +1,3 @@
+{"drugsDosageStructures":[
+ {"releaseNumber":125,"drugId":28100009555,"dosageStructureCode":30}
+]}
5 src/test/resources/log4j.properties
@@ -0,0 +1,5 @@
+log4j.rootCategory=ERROR, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
2  src/test/resources/test.properties
@@ -0,0 +1,2 @@
+test.mysql.port=3307
+test.db.name=sdm_warehouse_dosering_test
Please sign in to comment.
Something went wrong with that request. Please try again.