Skip to content

Commit

Permalink
Merge pull request #434 from SEEG-Oxford/healthmap-config-page
Browse files Browse the repository at this point in the history
Add HealthMap config page
  • Loading branch information
laurence-hudson-tessella committed Nov 17, 2015
2 parents 320b2aa + c853e87 commit f2998bd
Show file tree
Hide file tree
Showing 38 changed files with 1,787 additions and 207 deletions.
4 changes: 4 additions & 0 deletions db/migrations/1511161054__allow_edits_for_subdiseases.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Allow healthmap_subdisease to be edited by the platform.
--
-- Copyright (c) 2015 University of Oxford
GRANT INSERT, UPDATE ON TABLE healthmap_subdisease TO ${application_username};
4 changes: 4 additions & 0 deletions db/migrations/1511161511__allow_subdisease_without_parent.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Allow healthmap_subdisease without parent healthmap_disease.
--
-- Copyright (c) 2015 University of Oxford
ALTER TABLE healthmap_subdisease ALTER COLUMN healthmap_disease_id DROP NOT NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<bean id="expertService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.ExpertServiceImpl" autowire="constructor"/>
<bean id="locationService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.LocationServiceImpl" autowire="constructor"/>
<bean id="geometryService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.GeometryServiceImpl" autowire="constructor"/>
<bean id="healthMapService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.HealthMapServiceImpl" autowire="constructor"/>
<bean id="modelRunService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.ModelRunServiceImpl" autowire="constructor"/>
<bean id="reportingService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.ReportingServiceImpl" autowire="constructor"/>
<bean id="validationParameterCacheService" class="uk.ac.ox.zoo.seeg.abraid.mp.common.service.core.ValidationParameterCacheServiceImpl" autowire="constructor"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
* Copyright (c) 2014 University of Oxford
*/
public interface HealthMapDiseaseDao {
/**
* Gets all diseases.
* @return All diseases.
*/
List<HealthMapDisease> getAll();

/**
* Gets a HealthMap disease by ID.
* @param id The ID.
* @return The HealthMap disease, or null if not found.
*/
HealthMapDisease getById(Integer id);

/**
* Gets all diseases.
* @return All diseases.
*/
List<HealthMapDisease> getAll();

/**
* Saves the specified HealthMap disease.
* @param disease The disease to save.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@
* Copyright (c) 2014 University of Oxford
*/
public interface HealthMapSubDiseaseDao {
/**
* Gets a HealthMapSubDisease by ID.
*
* @param id The ID.
* @return The HealthMapSubDisease with the specified ID, or null if not found.
*/
HealthMapSubDisease getById(Integer id);

/**
* Gets all sub-diseases.
* @return All sub-diseases.
*/
List<HealthMapSubDisease> getAll();

/**
* Gets a HealthMap sub-disease by name.
* @param name The name.
* @return The HealthMap sub-disease, or null if not found.
* Saves the specified HealthMap subdisease.
* @param disease The disease to save.
*/
HealthMapSubDisease getByName(String name);
void save(HealthMapSubDisease disease);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,4 @@ public class HealthMapSubDiseaseDaoImpl extends AbstractDao<HealthMapSubDisease,
public HealthMapSubDiseaseDaoImpl(SessionFactory sessionFactory) {
super(sessionFactory);
}

/**
* Gets a HealthMap sub-disease by name.
* @param name The name.
* @return The HealthMap sub-disease, or null if not found.
*/
public HealthMapSubDisease getByName(String name) {
return uniqueResultNamedQuery("getHealthMapSubDiseaseByName", "name", name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
* Represents a "sub-disease" as defined by HealthMap. This is specified in the comment field of a HealthMap alert.
*
* Copyright (c) 2014 University of Oxford
*/
@NamedQueries({
@NamedQuery(
name = "getHealthMapSubDiseaseByName",
query = "from HealthMapSubDisease where name=:name"
)
})
@Entity
@Table(name = "healthmap_subdisease")
@Immutable
public class HealthMapSubDisease {
// The primary key.
@Id
Expand Down Expand Up @@ -68,6 +59,10 @@ public HealthMapDisease getHealthMapDisease() {
return healthMapDisease;
}

public void setHealthMapDisease(HealthMapDisease healthMapDisease) {
this.healthMapDisease = healthMapDisease;
}

public String getName() {
return name;
}
Expand All @@ -76,6 +71,10 @@ public DiseaseGroup getDiseaseGroup() {
return diseaseGroup;
}

public void setDiseaseGroup(DiseaseGroup diseaseGroup) {
this.diseaseGroup = diseaseGroup;
}

public DateTime getCreatedDate() {
return createdDate;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package uk.ac.ox.zoo.seeg.abraid.mp.common.dto.json;

/**
* A JSON DTO used identify a HealthMap disease.
* Copyright (c) 2015 University of Oxford
*/
public class JsonHealthMapDisease extends JsonNamedEntry {
private JsonNamedEntry abraidDisease;

public JsonHealthMapDisease() {
}

public JsonHealthMapDisease(Integer id, String name, JsonNamedEntry abraidDisease) {
super(id, name);
setAbraidDisease(abraidDisease);
}

public JsonNamedEntry getAbraidDisease() {
return abraidDisease;
}

public void setAbraidDisease(JsonNamedEntry abraidDisease) {
this.abraidDisease = abraidDisease;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package uk.ac.ox.zoo.seeg.abraid.mp.common.dto.json;

/**
* A JSON DTO used identify a HealthMap subdisease.
* Copyright (c) 2015 University of Oxford
*/
public class JsonHealthMapSubDisease extends JsonHealthMapDisease {
private JsonNamedEntry parent;

public JsonHealthMapSubDisease() {
}

public JsonHealthMapSubDisease(
Integer id, String name, JsonNamedEntry abraidDisease, JsonNamedEntry parent) {
super(id, name, abraidDisease);
setParent(parent);
}

public JsonNamedEntry getParent() {
return parent;
}

public void setParent(JsonNamedEntry parent) {
this.parent = parent;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package uk.ac.ox.zoo.seeg.abraid.mp.common.dto.json;

/**
* A base JSON dto to represent any object with an ID and name.
* Copyright (c) 2015 University of Oxford
*/
public class JsonNamedEntry {
private Integer id;
private String name;

public JsonNamedEntry() {
}

public JsonNamedEntry(Integer id, String name) {
setId(id);
setName(name);
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@
* Copyright (c) 2014 University of Oxford
*/
public interface DiseaseService {
/**
* Gets all HealthMap diseases.
* @return All HealthMap diseases.
*/
List<HealthMapDisease> getAllHealthMapDiseases();

/**
* Gets all HealthMap sub-diseases.
* @return All HealthMap sub-diseases.
*/
List<HealthMapSubDisease> getAllHealthMapSubDiseases();

/**
* Gets all disease groups.
* @return All disease groups.
Expand Down Expand Up @@ -223,12 +211,6 @@ List<DiseaseOccurrenceReview> getDiseaseOccurrenceReviewsForOccurrencesInValidat
*/
void saveDiseaseGroup(DiseaseGroup diseaseGroup);

/**
* Saves a HealthMap disease.
* @param disease The disease to save.
*/
void saveHealthMapDisease(HealthMapDisease disease);

/**
* Saves a disease extent class that is associated with an admin unit (global or tropical).
* @param adminUnitDiseaseExtentClass The object to save.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class DiseaseServiceImpl implements DiseaseService {
private DiseaseOccurrenceDao diseaseOccurrenceDao;
private DiseaseOccurrenceReviewDao diseaseOccurrenceReviewDao;
private DiseaseGroupDao diseaseGroupDao;
private HealthMapDiseaseDao healthMapDiseaseDao;
private HealthMapSubDiseaseDao healthMapSubDiseaseDao;
private ValidatorDiseaseGroupDao validatorDiseaseGroupDao;
private AdminUnitDiseaseExtentClassDao adminUnitDiseaseExtentClassDao;

Expand All @@ -35,8 +33,6 @@ public class DiseaseServiceImpl implements DiseaseService {
public DiseaseServiceImpl(DiseaseOccurrenceDao diseaseOccurrenceDao,
DiseaseOccurrenceReviewDao diseaseOccurrenceReviewDao,
DiseaseGroupDao diseaseGroupDao,
HealthMapDiseaseDao healthMapDiseaseDao,
HealthMapSubDiseaseDao healthMapSubDiseaseDao,
ValidatorDiseaseGroupDao validatorDiseaseGroupDao,
AdminUnitDiseaseExtentClassDao adminUnitDiseaseExtentClassDao,
ModelRunDao modelRunDao,
Expand All @@ -46,8 +42,6 @@ public DiseaseServiceImpl(DiseaseOccurrenceDao diseaseOccurrenceDao,
this.diseaseOccurrenceDao = diseaseOccurrenceDao;
this.diseaseOccurrenceReviewDao = diseaseOccurrenceReviewDao;
this.diseaseGroupDao = diseaseGroupDao;
this.healthMapDiseaseDao = healthMapDiseaseDao;
this.healthMapSubDiseaseDao = healthMapSubDiseaseDao;
this.validatorDiseaseGroupDao = validatorDiseaseGroupDao;
this.adminUnitDiseaseExtentClassDao = adminUnitDiseaseExtentClassDao;
this.modelRunDao = modelRunDao;
Expand All @@ -56,24 +50,6 @@ public DiseaseServiceImpl(DiseaseOccurrenceDao diseaseOccurrenceDao,
this.nativeSQL = nativeSQL;
}

/**
* Gets all HealthMap diseases.
* @return All HealthMap diseases.
*/
@Override
public List<HealthMapDisease> getAllHealthMapDiseases() {
return healthMapDiseaseDao.getAll();
}

/**
* Gets all HealthMap sub-diseases.
* @return All HealthMap sub-diseases.
*/
@Override
public List<HealthMapSubDisease> getAllHealthMapSubDiseases() {
return healthMapSubDiseaseDao.getAll();
}

/**
* Gets all disease groups.
* @return All disease groups.
Expand Down Expand Up @@ -424,15 +400,6 @@ public void saveDiseaseGroup(DiseaseGroup diseaseGroup) {
diseaseGroupDao.save(diseaseGroup);
}

/**
* Saves a HealthMap disease.
* @param disease The disease to save.
*/
@Override
public void saveHealthMapDisease(HealthMapDisease disease) {
healthMapDiseaseDao.save(disease);
}

/**
* Saves a disease extent class that is associated with an admin unit (global or tropical).
* @param adminUnitDiseaseExtentClass The object to save.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package uk.ac.ox.zoo.seeg.abraid.mp.common.service.core;

import uk.ac.ox.zoo.seeg.abraid.mp.common.domain.HealthMapDisease;
import uk.ac.ox.zoo.seeg.abraid.mp.common.domain.HealthMapSubDisease;

import java.util.List;

/**
* Service interface for HealthMap configuration.
* Copyright (c) 2015 University of Oxford
*/
public interface HealthMapService {
/**
* Gets a HealthMap disease by ID.
* @param id The ID.
* @return The HealthMap disease, or null if not found.
*/
HealthMapDisease getHealthMapDiseasesById(Integer id);

/**
* Gets a HealthMap subdisease by ID.
* @param id The ID.
* @return The HealthMap subdisease, or null if not found.
*/
HealthMapSubDisease getHealthMapSubDiseasesById(Integer id);

/**
* Gets all HealthMap diseases.
* @return All HealthMap diseases.
*/
List<HealthMapDisease> getAllHealthMapDiseases();

/**
* Gets all HealthMap sub-diseases.
* @return All HealthMap sub-diseases.
*/
List<HealthMapSubDisease> getAllHealthMapSubDiseases();

/**
* Saves a HealthMap disease.
* @param disease The disease to save.
*/
void saveHealthMapDisease(HealthMapDisease disease);

/**
* Saves a HealthMap subdisease.
* @param disease The disease to save.
*/
void saveHealthMapSubDisease(HealthMapSubDisease disease);
}
Loading

0 comments on commit f2998bd

Please sign in to comment.