Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
fb72d8f7
Commit
fb72d8f7
authored
Sep 01, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide overview of filtered data
parent
9ca05d84
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
279 additions
and
6 deletions
+279
-6
src/main/java/org/genesys2/server/model/elastic/AccessionDetails.java
...a/org/genesys2/server/model/elastic/AccessionDetails.java
+1
-0
src/main/java/org/genesys2/server/service/ElasticService.java
...main/java/org/genesys2/server/service/ElasticService.java
+0
-2
src/main/java/org/genesys2/server/service/FilterConstants.java
...ain/java/org/genesys2/server/service/FilterConstants.java
+6
-0
src/main/java/org/genesys2/server/servlet/controller/ExplorerController.java
...enesys2/server/servlet/controller/ExplorerController.java
+42
-0
src/main/java/org/genesys2/server/servlet/controller/JspHelper.java
...ava/org/genesys2/server/servlet/controller/JspHelper.java
+8
-0
src/main/resources/content/language.properties
src/main/resources/content/language.properties
+14
-0
src/main/webapp/WEB-INF/jsp/accession/explore.jsp
src/main/webapp/WEB-INF/jsp/accession/explore.jsp
+1
-0
src/main/webapp/WEB-INF/jsp/accession/overview.jsp
src/main/webapp/WEB-INF/jsp/accession/overview.jsp
+143
-0
src/main/webapp/WEB-INF/jsp/accession/termresult.jspf
src/main/webapp/WEB-INF/jsp/accession/termresult.jspf
+41
-0
src/main/webapp/html/css/custom.css
src/main/webapp/html/css/custom.css
+23
-1
src/main/webapp/html/css/responsive.css
src/main/webapp/html/css/responsive.css
+0
-2
src/test/java/org/genesys2/server/service/impl/ElasticsearchTest.java
...a/org/genesys2/server/service/impl/ElasticsearchTest.java
+0
-1
No files found.
src/main/java/org/genesys2/server/model/elastic/AccessionDetails.java
View file @
fb72d8f7
...
...
@@ -45,6 +45,7 @@ public class AccessionDetails {
private
String
acqSrc
;
private
Boolean
available
;
private
Date
createdDate
;
// FIXME @Field(index = FieldIndex.not_analyzed, type = FieldType.String)
private
List
<
String
>
duplSite
;
private
Boolean
mlsStatus
;
private
Boolean
art15
;
...
...
src/main/java/org/genesys2/server/service/ElasticService.java
View file @
fb72d8f7
...
...
@@ -17,14 +17,12 @@
package
org.genesys2.server.service
;
import
java.util.Collection
;
import
java.util.List
;
import
org.genesys2.server.model.elastic.AccessionDetails
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilters
;
import
org.genesys2.server.service.impl.SearchException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.elasticsearch.core.facet.result.Term
;
import
org.springframework.data.elasticsearch.core.facet.result.TermResult
;
public
interface
ElasticService
{
...
...
src/main/java/org/genesys2/server/service/FilterConstants.java
View file @
fb72d8f7
...
...
@@ -57,4 +57,10 @@ public interface FilterConstants {
public
static
final
String
TAXONOMY_GENUS
=
"taxonomy.genus"
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
DUPLSITE
=
"duplSite"
;
public
static
final
String
DONORCODE
=
"donorCode"
;
public
static
final
String
INSTITUTE_COUNTRY_ISO3
=
"institute.country.iso3"
;
}
src/main/java/org/genesys2/server/servlet/controller/ExplorerController.java
View file @
fb72d8f7
...
...
@@ -441,4 +441,46 @@ public class ExplorerController extends BaseController {
}
}
@RequestMapping
(
value
=
"/explore/overview"
)
public
String
overview
(
ModelMap
model
,
@RequestParam
(
value
=
"filter"
,
required
=
false
,
defaultValue
=
"{}"
)
String
jsonFilter
)
throws
IOException
,
SearchException
{
AppliedFilters
appliedFilters
=
mapper
.
readValue
(
jsonFilter
,
AppliedFilters
.
class
);
// Composition overview
overviewInstitutes
(
model
,
appliedFilters
);
overviewComposition
(
model
,
appliedFilters
);
overviewAvailability
(
model
,
appliedFilters
);
overviewManagement
(
model
,
appliedFilters
);
overviewSources
(
model
,
appliedFilters
);
return
"/accession/overview"
;
}
private
void
overviewInstitutes
(
ModelMap
model
,
AppliedFilters
appliedFilters
)
throws
SearchException
{
model
.
addAttribute
(
"statsInstCode"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
INSTCODE
,
10
));
model
.
addAttribute
(
"statsInstCountry"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
INSTITUTE_COUNTRY_ISO3
,
10
));
}
private
void
overviewSources
(
ModelMap
model
,
AppliedFilters
appliedFilters
)
throws
SearchException
{
model
.
addAttribute
(
"statsOrgCty"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
ORGCTY_ISO3
,
10
));
model
.
addAttribute
(
"statsDonorCode"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
DONORCODE
,
10
));
}
private
void
overviewAvailability
(
ModelMap
model
,
AppliedFilters
appliedFilters
)
throws
SearchException
{
model
.
addAttribute
(
"statsMLS"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
MLSSTATUS
,
2
));
model
.
addAttribute
(
"statsAvailable"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
AVAILABLE
,
2
));
}
private
void
overviewManagement
(
ModelMap
model
,
AppliedFilters
appliedFilters
)
throws
SearchException
{
model
.
addAttribute
(
"statsStorage"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
STORAGE
,
10
));
model
.
addAttribute
(
"statsDuplSite"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
DUPLSITE
,
10
));
}
private
void
overviewComposition
(
ModelMap
model
,
AppliedFilters
appliedFilters
)
throws
SearchException
{
model
.
addAttribute
(
"statsGenus"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
TAXONOMY_GENUS
,
10
));
model
.
addAttribute
(
"statsSpecies"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
TAXONOMY_SPECIES
,
10
));
model
.
addAttribute
(
"statsCrops"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
CROPS
,
10
));
model
.
addAttribute
(
"statsSampStat"
,
elasticService
.
termStatistics
(
appliedFilters
,
FilterConstants
.
SAMPSTAT
,
10
));
}
}
src/main/java/org/genesys2/server/servlet/controller/JspHelper.java
View file @
fb72d8f7
...
...
@@ -18,7 +18,9 @@ package org.genesys2.server.servlet.controller;
import
org.genesys2.server.exception.UserException
;
import
org.genesys2.server.model.impl.Country
;
import
org.genesys2.server.model.impl.Crop
;
import
org.genesys2.server.model.impl.User
;
import
org.genesys2.server.service.CropService
;
import
org.genesys2.server.service.GeoService
;
import
org.genesys2.server.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -30,6 +32,8 @@ public class JspHelper {
private
UserService
userService
;
@Autowired
private
GeoService
geoService
;
@Autowired
private
CropService
cropService
;
public
String
userFullName
(
Long
userId
)
{
if
(
userId
==
null
)
{
...
...
@@ -53,4 +57,8 @@ public class JspHelper {
public
Country
getCountry
(
String
iso3
)
{
return
geoService
.
getCountry
(
iso3
);
}
public
Crop
getCrop
(
String
shortName
)
{
return
cropService
.
getCrop
(
shortName
);
}
}
src/main/resources/content/language.properties
View file @
fb72d8f7
...
...
@@ -336,6 +336,7 @@ filter.alias=Accession name
filter.crops
=
Crop name
filter.orgCty.iso3
=
Country of Origin
filter.institute.code
=
Holding Institute name
filter.institute.country.iso3
=
Country of holding institute
filter.sampStat
=
Biological status of accession
filter.institute.code
=
Holding Institute
filter.geo.latitude
=
Latitude
...
...
@@ -348,6 +349,8 @@ filter.taxonomy.sciName=Scientific name
filter.sgsv
=
Safety duplicated in Svalbard
filter.mlsStatus
=
MLS status of the accession
filter.available
=
Available for distribution
filter.donorCode
=
Donor institute
filter.duplSite
=
Site of safety duplication
filter.download-dwca
=
Download ZIP
filter.add
=
Add filter
filter.additional
=
Additional filters
...
...
@@ -534,3 +537,14 @@ session.expiry-warning=Your current session is about to expire. Do you wish to e
session.expiry-extend
=
Extend session
download.kml
=
Download KML
data-overview
=
Statistical overview
data-overview.short
=
Overview
data-overview.institutes
=
Holding institutes
data-overview.composition
=
Composition of genebank holdings
data-overview.sources
=
Sources of material
data-overview.management
=
Collection management
data-overview.availability
=
Availability of material
data-overview.otherCount
=
Other
data-overview.missingCount
=
Not provided
data-overview.totalCount
=
Total
src/main/webapp/WEB-INF/jsp/accession/explore.jsp
View file @
fb72d8f7
...
...
@@ -37,6 +37,7 @@
<button
class=
"btn btn-default"
type=
"submit"
><spring:message
code=
"filter.download-dwca"
/></button>
</form>
</c:if>
<a
class=
"btn btn-default"
href=
"
<c:url
value=
"/explore/overview"
><c:param
name=
"filter"
>
${jsonFilter}
</c:param></c:url>
"
><span
class=
"glyphicon glyphicon-eye-open"
></span><span
style=
"margin-left: 0.5em;"
><spring:message
code=
"data-overview.short"
/></span></a>
<a
class=
"btn btn-default"
href=
"
<c:url
value=
"/explore/map"
><c:param
name=
"filter"
>
${jsonFilter}
</c:param></c:url>
"
><span
class=
"glyphicon glyphicon-globe"
></span><span
style=
"margin-left: 0.5em;"
><spring:message
code=
"maps.view-map"
/></span></a>
</div>
</div>
...
...
src/main/webapp/WEB-INF/jsp/accession/overview.jsp
0 → 100644
View file @
fb72d8f7
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"data-overview"
/></title>
</head>
<body>
<h1>
<spring:message
code=
"data-overview"
/>
</h1>
<div
class=
"main-col-header clearfix"
>
<div
class=
"nav-header"
>
<div
class=
"results"
>
<a
href=
"javascript: window.history.go(-1);"
><spring:message
code=
"navigate.back"
/></a>
</div>
</div>
</div>
<h3><spring:message
code=
"data-overview.institutes"
/></h3>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-instcode"
><spring:message
code=
"filter.institute.code"
/></h4>
<c:set
var=
"type"
value=
"instCode"
/>
<c:set
var=
"termResult"
value=
"
${
statsInstCode
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-instcty"
><spring:message
code=
"filter.institute.country.iso3"
/></h4>
<c:set
var=
"type"
value=
"country"
/>
<c:set
var=
"termResult"
value=
"
${
statsInstCountry
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
</div>
<h3><spring:message
code=
"data-overview.composition"
/></h3>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-crops"
><spring:message
code=
"filter.crops"
/></h4>
<c:set
var=
"type"
value=
"crop"
/>
<c:set
var=
"termResult"
value=
"
${
statsCrops
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-sampstat"
><spring:message
code=
"filter.sampStat"
/></h4>
<c:set
var=
"type"
value=
"i18n.accession.sampleStatus"
/>
<c:set
var=
"termResult"
value=
"
${
statsSampStat
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
</div>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-genus"
><spring:message
code=
"filter.taxonomy.genus"
/></h4>
<c:set
var=
"termResult"
value=
"
${
statsGenus
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-species"
><spring:message
code=
"filter.taxonomy.species"
/></h4>
<c:set
var=
"termResult"
value=
"
${
statsSpecies
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
</div>
</div>
<h3><spring:message
code=
"data-overview.sources"
/></h3>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-orgcty"
><spring:message
code=
"filter.orgCty.iso3"
/></h4>
<c:set
var=
"type"
value=
"country"
/>
<c:set
var=
"termResult"
value=
"
${
statsOrgCty
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-donorcode"
><spring:message
code=
"filter.donorCode"
/></h4>
<c:set
var=
"type"
value=
"instCode"
/>
<c:set
var=
"termResult"
value=
"
${
statsDonorCode
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
</div>
<h3><spring:message
code=
"data-overview.availability"
/></h3>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-sampstat"
><spring:message
code=
"filter.mlsStatus"
/></h4>
<c:set
var=
"type"
value=
"bool"
/>
<c:set
var=
"termResult"
value=
"
${
statsMLS
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-available"
><spring:message
code=
"filter.available"
/></h4>
<c:set
var=
"type"
value=
"bool"
/>
<c:set
var=
"termResult"
value=
"
${
statsAvailable
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
</div>
<h3><spring:message
code=
"data-overview.management"
/></h3>
<div
class=
"row row-section"
>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-storage"
><spring:message
code=
"filter.storage"
/></h4>
<c:set
var=
"type"
value=
"i18n.accession.storage"
/>
<c:set
var=
"termResult"
value=
"
${
statsStorage
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<h4
id=
"stats-duplsite"
><spring:message
code=
"filter.duplSite"
/></h4>
<c:set
var=
"type"
value=
"instCode"
/>
<c:set
var=
"termResult"
value=
"
${
statsDuplSite
}
"
/>
<%@include
file=
"termresult.jspf"
%>
<c:remove
var=
"termResult"
/>
<c:remove
var=
"type"
/>
</div>
</div>
<content
tag=
"javascript"
>
<script
type=
"text/javascript"
>
</script>
</content>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/accession/termresult.jspf
0 → 100644
View file @
fb72d8f7
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<table class="accession">
<c:forEach items="${termResult.terms}" var="term">
<tr><td>
<c:choose>
<c:when test="${type=='country'}">
<a href="<c:url value="/geo/${term.term.toUpperCase()}" />"><c:out value="${jspHelper.getCountry(term.term).getName(pageContext.request.locale)}" /></a>
</c:when>
<c:when test="${type=='crop'}">
<c:out value="${jspHelper.getCrop(term.term).getName(pageContext.request.locale)}" />
</c:when>
<c:when test="${type=='instCode'}">
<a href="<c:url value="/wiews/${term.term.toUpperCase()}" />"><c:out value="${term.term.toUpperCase()}" /></a>
</c:when>
<c:when test="${type=='bool' and term.term=='T'}">
<spring:message code="boolean.true" />
</c:when>
<c:when test="${type=='bool' and term.term=='F'}">
<spring:message code="boolean.false" />
</c:when>
<c:when test="${type ne null && type.startsWith('i18n')}">
<spring:message code="${type.substring(5).concat('.').concat(term.term)}" />
</c:when>
<c:otherwise>${term.term}</c:otherwise>
</c:choose>
</td><td class="text-right"><fmt:formatNumber value="${term.count}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${term.count/(termResult.totalCount+termResult.missingCount)}" /></span></td></tr>
</c:forEach>
<c:if test="${termResult.otherCount gt 0}">
<tr><td><em><spring:message code="data-overview.otherCount" /></em></td><td class="text-right"><fmt:formatNumber value="${termResult.otherCount}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.otherCount/(termResult.totalCount+termResult.missingCount)}" /></span></td></tr>
</c:if>
<c:if test="${termResult.missingCount gt 0}">
<tr><td><em><spring:message code="data-overview.missingCount" /></em></td><td class="text-right"><fmt:formatNumber value="${termResult.missingCount}" /> <span class="terms-percent"><fmt:formatNumber pattern="#,##0.00%" value="${termResult.missingCount/(termResult.totalCount+termResult.missingCount)}" /></span></td></tr>
</c:if>
<%-- <tr><td><spring:message code="data-overview.totalCount" /></td><td class="text-right">!<fmt:formatNumber value="${termResult.totalCount+termResult.missingCount}" /></td></tr> --%>
</table>
\ No newline at end of file
src/main/webapp/html/css/custom.css
View file @
fb72d8f7
...
...
@@ -1961,4 +1961,26 @@ html[dir="rtl"] ul.statistics .stats-number {
.chart.chart-pie
{
padding
:
10px
;
}
\ No newline at end of file
}
.terms-percent
{
min-width
:
60px
;
display
:
inline-block
;
}
html
[
dir
=
"rtl"
]
.text-right
{
text-align
:
left
;
}
html
[
dir
=
"rtl"
]
.text-left
{
text-align
:
right
;
}
.row
{
margin-left
:
-10px
;
margin-right
:
-10px
;
}
.row-section
{
margin-bottom
:
2em
;
}
src/main/webapp/html/css/responsive.css
View file @
fb72d8f7
...
...
@@ -154,8 +154,6 @@
.container
{
padding-left
:
0
;
padding-right
:
0
;}
.row
{
margin
:
0
;}
#middle-col
{
border-top
:
10px
solid
#e7e5df
;}
#nav-main
.navbar
{
border-bottom
:
none
;
margin
:
0
;}
...
...
src/test/java/org/genesys2/server/service/impl/ElasticsearchTest.java
View file @
fb72d8f7
...
...
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertTrue;
import
java.io.IOException
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.log4j.Logger
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment