Beta 17032021
This commit is contained in:
parent
e04f137a4c
commit
906c9ac35b
|
@ -815,7 +815,7 @@ public class UsageStatsRepository {
|
|||
|
||||
while (rs.next()) {
|
||||
if (repositoryIdentifier != null) {
|
||||
executeBatchItemsDSR(reportItems, repositoryIdentifier, rs.getString(1), beginDate, endDate, metricType,granularity);
|
||||
executeBatchItemsDSR(reportItems, repositoryIdentifier, rs.getString(1), beginDate, endDate, metricType, granularity);
|
||||
} else {
|
||||
executeItemsAllRepoDSR(reportItems, rs.getString(1), beginDate, endDate, metricType, granularity);
|
||||
}
|
||||
|
@ -2147,7 +2147,7 @@ public class UsageStatsRepository {
|
|||
reportItem.addIdentifier(new COUNTER_Item_Identifiers(typeIdentifierArray[0], typeIdentifierArray[1]));
|
||||
}
|
||||
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()),
|
||||
metricTypeValue[0] == true ? rs.getString(3) : null, metricTypeValue[1] == true ? rs.getString(4) : null, metricTypeValue[2] == true ? rs.getString(9) : null, metricTypeValue[3] == true ? rs.getString(20) : null));
|
||||
metricTypeValue[0] == true ? rs.getString(3) : null, metricTypeValue[1] == true ? rs.getString(4) : null, metricTypeValue[2] == true ? rs.getString(9) : null, metricTypeValue[3] == true ? rs.getString(10) : null));
|
||||
reportItems.add(reportItem);
|
||||
|
||||
// }
|
||||
|
@ -2711,63 +2711,17 @@ public class UsageStatsRepository {
|
|||
connection = usageStatsDB.getConnection();
|
||||
|
||||
if (granularity.equalsIgnoreCase("totals")) {
|
||||
// if (dataType.equals("")) {
|
||||
// st = connection.prepareStatement("WITH tpd as (select id, concat(type,'#-#',pid) type_id from " + statsDB + ".result_pids) "
|
||||
// + "SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
// + "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, "
|
||||
// + "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
// + "dp.access_method as access_method "
|
||||
// + "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
// + statsDB + ".result_oids ro, tpd, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
// + "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id "
|
||||
// + "AND dp.ds_type=ro.oid "
|
||||
// + "GROUP BY rc.type, rs.title, us.result_id, rs.title, rs.year, dp.access_method order by rc.type ASC;");
|
||||
//
|
||||
// st.setString(1, beginDateStr);
|
||||
// st.setString(2, endDateStr);
|
||||
// st.setString(3, repositoryIdentifier);
|
||||
//
|
||||
// rs = st.executeQuery();
|
||||
// COUNTER_Dataset_Usage reportItem = null;
|
||||
//
|
||||
// boolean[] metricTypeValue = {false, false, false, false};
|
||||
// if (metricType.contains("Total_Dataset_Requests")) {
|
||||
// metricTypeValue[0] = true;
|
||||
// }
|
||||
// if (metricType.contains("Total_Dataset_Investigations")) {
|
||||
// metricTypeValue[1] = true;
|
||||
// }
|
||||
// if (metricType.contains("Unique_Dataset_Requests")) {
|
||||
// metricTypeValue[2] = true;
|
||||
// }
|
||||
// if (metricType.contains("Unique_Dataset_Investigations")) {
|
||||
// metricTypeValue[3] = true;
|
||||
// }
|
||||
//
|
||||
// while (rs.next()) {
|
||||
// reportItem = new COUNTER_Dataset_Usage(rs.getString(5), "OpenAIRE", platform, rs.getString(1), Integer.toString(rs.getInt(6)), rs.getString(10));
|
||||
// String[] identifiersAll = rs.getString(7).split("#!#");
|
||||
// for (int i = 0; i < identifiersAll.length; i++) {
|
||||
// String[] typeIdentifierArray = identifiersAll[i].split("#-#");
|
||||
// reportItem.addIdentifier(new COUNTER_Dataset_Identifiers(typeIdentifierArray[0], typeIdentifierArray[1]));
|
||||
// }
|
||||
//
|
||||
// reportItem.addPerformance(new COUNTER_Dataset_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate),
|
||||
// metricTypeValue[0] == true ? rs.getString(2) : null, metricTypeValue[1] == true ? rs.getString(3) : null, metricTypeValue[2] == true ? rs.getString(8) : null, metricTypeValue[3] == true ? rs.getString(9) : null));
|
||||
// reportItems.add(reportItem);
|
||||
// }
|
||||
//
|
||||
// } //else {
|
||||
|
||||
st = connection.prepareStatement("WITH tpd as (select id, concat(type,'#-#',pid) type_id from " + statsDB + ".result_pids) "
|
||||
+ "SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
+ "dp.access_method as access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, rs.year, dp.access_method ORDER by rc.type ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, rs.year, dp.access_method ORDER by rc.type ASC;");
|
||||
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
|
@ -2807,12 +2761,12 @@ public class UsageStatsRepository {
|
|||
+ "SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
+ "dp.access_method as access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
st.setString(3, repositoryIdentifier);
|
||||
|
@ -2900,12 +2854,12 @@ public class UsageStatsRepository {
|
|||
+ "SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews,"
|
||||
+ "dp.access_method as access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND us.result_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, rs.year, dp.access_method ORDER by rc.type ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, rs.year, dp.access_method ORDER by rc.type ASC;");
|
||||
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
|
@ -2945,12 +2899,12 @@ public class UsageStatsRepository {
|
|||
+ "SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
+ "dp.access_method as access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND us.result_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
st.setString(3, repositoryIdentifier);
|
||||
|
@ -3050,12 +3004,12 @@ public class UsageStatsRepository {
|
|||
+ "SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, ds.name, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
+ "dp.access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, " + statsDB + ".datasource ds, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=ds.id AND us.result_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, rs.year, ds.name,dp.access_method ORDER by rc.type ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, rs.year, ds.name,dp.access_method ORDER by rc.type ASC;");
|
||||
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
|
@ -3099,12 +3053,12 @@ public class UsageStatsRepository {
|
|||
+ "SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views, "
|
||||
+ "us.result_id as resultid, rs.title as item, rs.year as yop, group_concat(distinct tpd.type_id,'#!#') as oid, ds.name, "
|
||||
+ "count(case when us.downloads >0 then 1 else null end) as uniquedownloads, count(case when us.views >0 then 1 else null end) as uniqueviews, "
|
||||
+ "dp.access_method "
|
||||
+ "case when us.source='Datacite' then dp.access_method else 'regular' end as access_method "
|
||||
+ "FROM " + usagestatsImpalaDB + ".usage_stats us, " + statsDB + ".result_classifications rc, " + statsDB + ".result rs, "
|
||||
+ statsDB + ".result_oids ro, tpd, " + statsDB + ".datasource ds, datasetsusagestats_20210312a.datasetsperformance dp "
|
||||
+ "WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=ds.id AND us.result_id=? AND rc.id=us.result_id "
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' "
|
||||
+ "GROUP BY ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, ds.name, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
+ "AND us.result_id=rs.id AND ro.id=us.result_id AND tpd.id=us.result_id AND rc.type='Dataset' AND dp.ds_type=ro.oid "
|
||||
+ "GROUP BY us.source, ro.id, rc.type, rs.title, us.result_id, us.`date`, rs.year, ds.name, dp.access_method ORDER by rc.type, us.`date` ASC;");
|
||||
st.setString(1, beginDateStr);
|
||||
st.setString(2, endDateStr);
|
||||
st.setString(3, itemIdentifier);
|
||||
|
|
|
@ -548,7 +548,10 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
|||
}
|
||||
}
|
||||
|
||||
orgIdentifiers.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
|
||||
if(repositoryIdentifier.equals(""))
|
||||
orgIdentifiers=null;
|
||||
else
|
||||
orgIdentifiers.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
|
||||
|
||||
if (!granularity.equalsIgnoreCase("totals") && !granularity.equalsIgnoreCase("monthly")) {
|
||||
reportExceptions.add(new SUSHI_Error_Model("3062", "Warning", "Invalid ReportAttribute Value", "usagecounts.openaire.eu", "Granularity: \'" + granularity + "\' unknown. Defaulting to Monthly"));
|
||||
|
@ -606,6 +609,8 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
|||
String institutionName=null;
|
||||
if(repositoryIdentifier!="-1")
|
||||
institutionName = usageStatsRepository.getInstitutionName(repositoryIdentifier);
|
||||
if(repoID.equals(""))
|
||||
institutionName=null;
|
||||
|
||||
//if (!repositoryIdentifier.equals("")) {
|
||||
// repoid = usageStatsRepository.getInstitutionID(repositoryIdentifier);
|
||||
|
@ -888,7 +893,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
|||
if (reportExceptions.size() == 0) {
|
||||
reportExceptions = null;
|
||||
}
|
||||
COUNTER_Dataset_Report reportResponse = new COUNTER_Dataset_Report(dateTime.format(formatter), customerID, "DST", "Dataset Report", institutionName, orgIdentifiers,
|
||||
COUNTER_Dataset_Report reportResponse = new COUNTER_Dataset_Report(dateTime.format(formatter), customerID, "DSR", "Dataset Report", institutionName, orgIdentifiers,
|
||||
reportExceptions, reportFilters, reportItems);
|
||||
|
||||
return reportResponse;
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
<p>Provide either a Repository Identifier or an Item Identifier<br />
|
||||
Identifier format: <b>namespace:value</b><br />
|
||||
Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br />
|
||||
Valid namespace for Dataset Identifier: <b>openaire</b>, <b>doi</b> or <b>oid</b>(for OAI-PMH).
|
||||
Valid namespace for Dataset Identifier: <b>doi</b> or <b>oid</b>(for OAI-PMH).
|
||||
</p>
|
||||
<div class="uk-grid">
|
||||
<div class=" uk-width-1-3 uk-text-right">
|
||||
|
@ -134,7 +134,7 @@
|
|||
Dataset Identifier:
|
||||
</div>
|
||||
<div class="uk-width-2-3">
|
||||
<input type="text" name="DatasetIdentifier" placeholder="e.g. openaire:od_________7::fb90de6f20d79783d05749d8f60417d5">
|
||||
<input type="text" name="DatasetIdentifier" placeholder="e.g. doi:10.xyz/12345">
|
||||
</div>
|
||||
</div>
|
||||
<p><b>Metric Type<b></p>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
<div class="uk-width-2-3">
|
||||
<select name='Release'>
|
||||
<option value="4">5</option>
|
||||
<option value="5">5</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -119,7 +119,7 @@
|
|||
<p>Provide either a Repository Identifier or an Item Identifier<br />
|
||||
Identifier format: <b>namespace:value</b><br />
|
||||
Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br />
|
||||
Valid namespace for Item Identifier: <b>openaire</b>, <b>doi</b> or <b>oid</b>(for OAI-PMH).
|
||||
Valid namespace for Item Identifier: <b>doi</b> or <b>oid</b>(for OAI-PMH).
|
||||
</p>
|
||||
<div class="uk-grid">
|
||||
<div class=" uk-width-1-3 uk-text-right">
|
||||
|
@ -134,7 +134,7 @@
|
|||
Item Identifier:
|
||||
</div>
|
||||
<div class="uk-width-2-3">
|
||||
<input type="text" name="ItemIdentifier" placeholder="e.g. openaire:od_________7::fb90de6f20d79783d05749d8f60417d5">
|
||||
<input type="text" name="ItemIdentifier" placeholder="e.g. doi:10.xyz/12345">
|
||||
</div>
|
||||
</div>
|
||||
<p><b>Metric Type<b></p>
|
||||
|
@ -147,7 +147,7 @@
|
|||
Item Data Type:
|
||||
</div>
|
||||
<div class="uk-width-2-3">
|
||||
<select name='ItemDataType'>
|
||||
<select name='DataType'>
|
||||
<option value="">--- Select ItemDataType ---</option>
|
||||
<option value='Annotation'>Annotation</option>
|
||||
<option value='Article'>Article</option>
|
||||
|
|
Loading…
Reference in New Issue