dsm results

This commit is contained in:
Michele Artini 2022-12-14 16:30:15 +01:00
parent 6f578df920
commit 48b16d8023
281 changed files with 273 additions and 23 deletions

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>apps</artifactId> <artifactId>apps</artifactId>
<version>3.2.9-SNAPSHOT</version> <version>3.3.3-SNAPSHOT</version>
<relativePath>../</relativePath> <relativePath>../</relativePath>
</parent> </parent>

View File

@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import eu.dnetlib.data.openaire.dsm.model.Datasource;
import eu.dnetlib.openaire.dsm.domain.BrowseTerm; import eu.dnetlib.openaire.dsm.domain.BrowseTerm;
import eu.dnetlib.openaire.dsm.domain.SearchApisEntry;
import eu.dnetlib.openaire.dsm.utils.DsmBrowsableFields; import eu.dnetlib.openaire.dsm.utils.DsmBrowsableFields;
@RestController @RestController
@ -27,12 +27,12 @@ public class DsmAjaxController extends AbstractDnetController {
} }
@GetMapping("/searchByField/{field}") @GetMapping("/searchByField/{field}")
public List<Datasource> searchByField(@PathVariable final String field, @RequestParam final String value) { public List<SearchApisEntry> searchByField(@PathVariable final String field, @RequestParam final String value) {
return dsmService.searchByField(DsmBrowsableFields.valueOf(field), value); return dsmService.searchByField(DsmBrowsableFields.valueOf(field), value);
} }
@GetMapping("/search") @GetMapping("/search")
public List<Datasource> search(@RequestParam final String value) { public List<SearchApisEntry> search(@RequestParam final String value) {
return dsmService.search(value); return dsmService.search(value);
} }

View File

@ -56,6 +56,7 @@ import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.RequestFilter; import eu.dnetlib.openaire.dsm.domain.RequestFilter;
import eu.dnetlib.openaire.dsm.domain.RequestSort; import eu.dnetlib.openaire.dsm.domain.RequestSort;
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder; import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
import eu.dnetlib.openaire.dsm.domain.SearchApisEntry;
import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo; import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo;
import eu.dnetlib.openaire.dsm.domain.SimpleResponse; import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
import eu.dnetlib.openaire.dsm.utils.DsmBrowsableFields; import eu.dnetlib.openaire.dsm.utils.DsmBrowsableFields;
@ -447,12 +448,11 @@ public class DsmService {
return jdbcTemplate.query(f.browseSql, new BeanPropertyRowMapper<>(BrowseTerm.class)); return jdbcTemplate.query(f.browseSql, new BeanPropertyRowMapper<>(BrowseTerm.class));
} }
public List<Datasource> searchByField(final DsmBrowsableFields valueOf, final String value) { public List<SearchApisEntry> searchByField(final DsmBrowsableFields f, final String value) {
// TODO Auto-generated method stub return jdbcTemplate.query(f.searchSql, new BeanPropertyRowMapper<>(SearchApisEntry.class), value);
return null;
} }
public List<Datasource> search(final String value) { public List<SearchApisEntry> search(final String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }

View File

@ -0,0 +1,154 @@
package eu.dnetlib.openaire.dsm.domain;
public class SearchApisEntry implements Comparable<SearchApisEntry> {
private String id;
private String protocol;
private String compliance;
private Boolean active;
private String type;
private String aggrDate;
private Long aggrTotal;
private String dsId;
private String dsName;
private String websiteUrl;
private String dsOtherName;
private String organization;
private String country;
private String nsprefix;
private Boolean consenttermsofuse;
private Boolean fulltextdownload;
public String getId() {
return id;
}
public void setId(final String id) {
this.id = id;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(final String protocol) {
this.protocol = protocol;
}
public String getCompliance() {
return compliance;
}
public void setCompliance(final String compliance) {
this.compliance = compliance;
}
public Boolean getActive() {
return active;
}
public void setActive(final Boolean active) {
this.active = active;
}
public String getType() {
return type;
}
public void setType(final String type) {
this.type = type;
}
public String getAggrDate() {
return aggrDate;
}
public void setAggrDate(final String aggrDate) {
this.aggrDate = aggrDate;
}
public Long getAggrTotal() {
return aggrTotal;
}
public void setAggrTotal(final Long aggrTotal) {
this.aggrTotal = aggrTotal;
}
public String getDsId() {
return dsId;
}
public void setDsId(final String dsId) {
this.dsId = dsId;
}
public String getDsName() {
return dsName;
}
public void setDsName(final String dsName) {
this.dsName = dsName;
}
public String getWebsiteUrl() {
return websiteUrl;
}
public void setWebsiteUrl(final String websiteUrl) {
this.websiteUrl = websiteUrl;
}
public String getDsOtherName() {
return dsOtherName;
}
public void setDsOtherName(final String dsOtherName) {
this.dsOtherName = dsOtherName;
}
public String getOrganization() {
return organization;
}
public void setOrganization(final String organization) {
this.organization = organization;
}
public String getCountry() {
return country;
}
public void setCountry(final String country) {
this.country = country;
}
public String getNsprefix() {
return nsprefix;
}
public void setNsprefix(final String nsprefix) {
this.nsprefix = nsprefix;
}
public Boolean getConsenttermsofuse() {
return consenttermsofuse;
}
public void setConsenttermsofuse(final Boolean consenttermsofuse) {
this.consenttermsofuse = consenttermsofuse;
}
public Boolean getFulltextdownload() {
return fulltextdownload;
}
public void setFulltextdownload(final Boolean fulltextdownload) {
this.fulltextdownload = fulltextdownload;
}
@Override
public int compareTo(final SearchApisEntry o) {
return compliance.compareTo(o.getCompliance());
}
}

View File

@ -7,23 +7,24 @@ import org.apache.commons.io.IOUtils;
public enum DsmBrowsableFields { public enum DsmBrowsableFields {
type("Datasource typologies", "browseType.sql", "searchByType.sql"), type("Datasource typologies", "browseType.sql"),
country("Countries", "browseCountry.sql", "searchByCountry.sql"), country("Countries", "browseCountry.sql"),
compliance("Compatibility levels", "browseCompliance.sql", "searchByCompliance.sql"), compliance("Compatibility levels", "browseCompliance.sql"),
protocol("API protocols", "browseProtocol.sql", "searchByProtocol.sql"), protocol("API protocols", "browseProtocol.sql"),
active("API activation", "browseActive.sql", "searchByActive.sql"), active("API activation", "browseActive.sql"),
consenttermsofuse("Consent terms of use", "browseConsentTermOfUse.sql", "searchByConsentTermOfUse.sql"), consenttermsofuse("Consent terms of use", "browseConsentTermOfUse.sql"),
fulltextdownload("Fulltext download", "browseFulltextDownload.sql", "searchByFulltextDownload.sql"); fulltextdownload("Fulltext download", "browseFulltextDownload.sql");
public final String desc; public final String desc;
public final String browseSql; public final String browseSql;
public final String searchSql; public final String searchSql;
private DsmBrowsableFields(final String desc, final String browseSqlFile, final String searchSqlFile) { private DsmBrowsableFields(final String desc, final String browseSqlFile) {
this.desc = desc; this.desc = desc;
try { try {
this.browseSql = IOUtils.toString(getClass().getResourceAsStream("/sql/dsm/ui/" + browseSqlFile), StandardCharsets.UTF_8.name()); this.browseSql = IOUtils.toString(getClass().getResourceAsStream("/sql/dsm/ui/" + browseSqlFile), StandardCharsets.UTF_8.name());
this.searchSql = IOUtils.toString(getClass().getResourceAsStream("/sql/dsm/ui/" + searchSqlFile), StandardCharsets.UTF_8.name()); this.searchSql = IOUtils.toString(getClass().getResourceAsStream("/sql/dsm/ui/searchApis.tmpl.sql"), StandardCharsets.UTF_8.name())
.replaceAll("%condition%", this.name() + "::text = ?");
} catch (final IOException e) { } catch (final IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -1,5 +1,8 @@
server.port=8280 server.port=8280
server.public_url =
server.public_desc = API Base URL
spring.profiles.active=dev spring.profiles.active=dev
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-is-application/effective-pom.xml maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-is-application/effective-pom.xml

View File

@ -1,5 +1,5 @@
select select
a.active as term, a.active::text as term,
case when a.active is null then 'UNKNOWN' when a.active then 'active' else 'not active' end as name, case when a.active is null then 'UNKNOWN' when a.active then 'active' else 'not active' end as name,
count(*) as total count(*) as total
from dsm_api a from dsm_api a

View File

@ -1,5 +1,5 @@
select select
d.consenttermsofuse as term, d.consenttermsofuse::text as term,
case when d.consenttermsofuse is null then 'UNKNOWN' when d.consenttermsofuse then 'YES' else 'NO' end as name, case when d.consenttermsofuse is null then 'UNKNOWN' when d.consenttermsofuse then 'YES' else 'NO' end as name,
count(*) as total count(*) as total
from from

View File

@ -1,5 +1,5 @@
select select
d.fulltextdownload as term, d.fulltextdownload::text as term,
case when d.fulltextdownload is null then 'UNKNOWN' when d.fulltextdownload then 'Available' else 'Not available' end as name, case when d.fulltextdownload is null then 'UNKNOWN' when d.fulltextdownload then 'Available' else 'Not available' end as name,
count(*) as total count(*) as total
from from

View File

@ -0,0 +1,40 @@
SELECT * FROM (SELECT
a.id AS "id",
a.protocol AS "protocol",
coalesce(a.compatibility_override, a.compatibility) AS "compliance",
a.active AS "active",
ds.eosc_datasource_type AS "type",
coalesce(a.last_aggregation_date::text, a.last_download_date::text, '') AS "aggrDate",
coalesce(a.last_aggregation_total, a.last_download_total, 0) AS "aggrTotal",
ds.id AS "dsId",
ds.officialname AS "dsName",
ds.englishname AS "dsOtherName",
ds.namespaceprefix AS "nsprefix",
ds.websiteurl AS "websiteUrl",
coalesce((array_agg(o.country))[1], '-') AS "country",
(array_agg(o.legalname))[1] AS "organization",
ds.consenttermsofuse AS "consenttermsofuse",
ds.fulltextdownload AS "fulltextdownload"
FROM dsm_api a
LEFT OUTER JOIN dsm_services ds ON (a.service = ds.id)
LEFT OUTER JOIN dsm_service_organization dsorg ON (ds.id = dsorg.service)
LEFT OUTER JOIN dsm_organizations o ON (dsorg.organization = o.id)
WHERE ds.dedup_main_service = true
GROUP BY
a.id,
a.protocol,
a.compatibility_override,
a.compatibility,
a.active,
a.last_aggregation_date,
a.last_download_date,
a.last_aggregation_total,
a.last_download_total,
ds.id,
ds.officialname,
ds.namespaceprefix,
ds.websiteurl,
ds.consenttermsofuse,
ds.fulltextdownload,
eosc_datasource_type
) AS t WHERE %condition%;

View File

@ -17,13 +17,65 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row mt-5"> <div class="row mt-5">
<div class="col"> <div class="col">
{{results}}
<p ng-show="results.length > 0">
<input type="text" class="form-control form-control-sm" ng-model="apiFilter" placeholder="Filter..."/>
</p>
<p>
<span class="text-muted"><b>Number of APIs:</b> {{(results | filter:apiFilter).length}}</span>
</p>
<div class="card mb-4 small" ng-repeat="r in results|filter:apiFilter">
<div class="card-body small">
<h5 class="card-title" title="{{r.id}}">{{r.dsName}}
<span class="badge badge-primary" title="protocol">{{r.protocol}}</span>
<span class="badge badge-success" title="compliance">{{r.compliance}}</span>
<span style="font-size: 0.6em" ng-if="r.dsOtherName && r.dsName != r.dsOtherName"><br />{{r.dsOtherName}}</span>
</h5>
<table class="table table-sm">
<tr>
<th style="width: 20em;">Datasource Id</th>
<td>{{r.dsId}}</td>
</tr><tr>
<th>API Id</th>
<td>{{r.id}}</td>
</tr><tr>
<th>Namespace Prefix</th>
<td>{{r.nsprefix}}</td>
</tr><tr ng-if="r.organization">
<th>Organization</th>
<td>{{r.organization}} <img src="common/images/flags/{{r.country}}.gif" title="{{r.country}}" alt="" ng-if="r.country"/></td>
</tr><tr ng-if="r.websiteUrl">
<th>URL</th>
<td><a href="{{r.websiteUrl}}" target="_blank">{{r.websiteUrl}}</a></td>
</tr><tr>
<th>Type</th>
<td>{{r.type}}</td>
</tr><tr>
<th>Status</th>
<td><span class="badge badge-success" ng-if="r.active">active</span><span class="badge badge-danger" ng-if="!r.active">not active</span></td>
</tr><tr ng-if="r.consenttermsofuse">
<th>Consent Terms of Use</th>
<td><span class="badge badge-success">YES</span></td>
</tr><tr ng-if="r.fulltextdownload">
<th>Fulltext Download</th>
<td><span class="badge badge-success">YES</span></td>
</tr>
</table>
</div>
<div class="card-footer small text-muted monospaced" ng-if="r.aggrDate && r.aggrTotal">
<b>Last aggregation:</b> {{r.aggrDate}} <b>(total: {{r.aggrTotal}})</b>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
<th:block th:replace="fragments/mainParts.html :: scripts"></th:block> <th:block th:replace="fragments/mainParts.html :: scripts"></th:block>
<script> <script>
var app = angular.module('dsmResultsApp', []); var app = angular.module('dsmResultsApp', []);

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

Some files were not shown because too many files have changed in this diff Show More