forked from D-Net/dnet-hadoop
Finished Sarc Stats
This commit is contained in:
parent
b3d51a954a
commit
2e701c547d
|
@ -188,18 +188,18 @@ public class SarcStats {
|
|||
ConnectDB.getConnection().close();
|
||||
|
||||
List<String[]> issnAndUrls = new ArrayList<String[]>();
|
||||
// issnAndUrls.add(new String[] {
|
||||
// "https://revistas.rcaap.pt/motricidade/sushiLite/v1_7/", "1646-107X"
|
||||
// });
|
||||
// issnAndUrls.add(new String[] {
|
||||
// "https://revistas.rcaap.pt/antropologicas/sushiLite/v1_7/", "0873-819X"
|
||||
// });
|
||||
// issnAndUrls.add(new String[] {
|
||||
// "https://revistas.rcaap.pt/interaccoes/sushiLite/v1_7/", "1646-2335"
|
||||
// });
|
||||
// issnAndUrls.add(new String[] {
|
||||
// "https://revistas.rcaap.pt/cct/sushiLite/v1_7/", "2182-3030"
|
||||
// });
|
||||
issnAndUrls.add(new String[] {
|
||||
"https://revistas.rcaap.pt/motricidade/sushiLite/v1_7/", "1646-107X"
|
||||
});
|
||||
issnAndUrls.add(new String[] {
|
||||
"https://revistas.rcaap.pt/antropologicas/sushiLite/v1_7/", "0873-819X"
|
||||
});
|
||||
issnAndUrls.add(new String[] {
|
||||
"https://revistas.rcaap.pt/interaccoes/sushiLite/v1_7/", "1646-2335"
|
||||
});
|
||||
issnAndUrls.add(new String[] {
|
||||
"https://revistas.rcaap.pt/cct/sushiLite/v1_7/", "2182-3030"
|
||||
});
|
||||
issnAndUrls.add(new String[] {
|
||||
"https://actapediatrica.spp.pt/sushiLite/v1_7/", "0873-9781"
|
||||
});
|
||||
|
@ -247,19 +247,33 @@ public class SarcStats {
|
|||
|
||||
}
|
||||
|
||||
public void sarcStats() throws Exception {
|
||||
public void finalizeSarcStats() throws Exception {
|
||||
stmt = ConnectDB.getConnection().createStatement();
|
||||
ConnectDB.getConnection().setAutoCommit(false);
|
||||
|
||||
// String sql = "SELECT s.source, d.id AS repository_id, ro.id as result_id, extract('year' from s.date::date)
|
||||
// ||'/'|| LPAD(CAST(extract('month' from s.date::date) AS VARCHAR), 2, '0') as date, s.count, '0' INTO
|
||||
// downloads_stats FROM sushilog s, datasource_oids d, result_oids ro WHERE s.repository=d.orid AND
|
||||
// s.rid=ro.orid AND metric_type='ft_total'";
|
||||
String sql = "INSERT INTO downloads_stats SELECT s.source, d.id AS repository_id, ro.id as result_id, extract('year' from s.date::date) ||'/'|| LPAD(CAST(extract('month' from s.date::date) AS VARCHAR), 2, '0') as date, s.count, '0' FROM sushilog s, public.datasource_oids d, public.datasource_results dr, public.result_pids ro WHERE d.orid LIKE '%' || s.repository || '%' AND dr.id=d.id AND dr.result=ro.id AND s.rid=ro.pid AND ro.type='doi' AND metric_type='ft_total' AND s.source='SARC-OJS';";
|
||||
stmt.executeUpdate(sql);
|
||||
// Insert into downloads_stats
|
||||
System.out.println("====> Inserting into downloads_stats");
|
||||
// String sql = "INSERT INTO downloads_stats SELECT s.source, d.id AS repository_id, ro.id as result_id, extract('year' from s.date::date) ||'/'|| LPAD(CAST(extract('month' from s.date::date) AS VARCHAR), 2, '0') as date, s.count, '0' FROM sushilog s, public.datasource_oids d, public.datasource_results dr, public.result_pids ro WHERE d.orid LIKE '%' || s.repository || '%' AND dr.id=d.id AND dr.result=ro.id AND s.rid=ro.pid AND ro.type='doi' AND metric_type='ft_total' AND s.source='SARC-OJS';";
|
||||
String insertDStats = "INSERT INTO " + ConnectDB.getUsageStatsDBSchema()
|
||||
+ ".downloads_stats SELECT s.source, d.id AS repository_id, " +
|
||||
"ro.id as result_id, CONCAT(YEAR(date), '/', LPAD(MONTH(date), 2, '0')) AS date, s.count, '0' " +
|
||||
"FROM " + ConnectDB.getUsageStatsDBSchema() + ".sarc_sushilogtmp s, " +
|
||||
ConnectDB.getStatsDBSchema() + ".datasource_oids d, " +
|
||||
ConnectDB.getStatsDBSchema() + ".datasource_results dr, " +
|
||||
ConnectDB.getStatsDBSchema() + ".result_pids ro \n" +
|
||||
"WHERE d.oid LIKE CONCAT('%', s.repository, '%') AND dr.id=d.id AND dr.result=ro.id AND " +
|
||||
"s.rid=ro.pid AND ro.type='doi' AND metric_type='ft_total' AND s.source='SARC-OJS'";
|
||||
stmt.executeUpdate(insertDStats);
|
||||
System.out.println("====> Inserted into downloads_stats");
|
||||
|
||||
// Insert into sushilog
|
||||
System.out.println("====> Inserting into sushilog");
|
||||
String insertSushiLog = "INSERT INTO " + ConnectDB.getUsageStatsDBSchema()
|
||||
+ ".sushilog SELECT * " + "FROM " + ConnectDB.getUsageStatsDBSchema() + ".sarc_sushilogtmp";
|
||||
stmt.executeUpdate(insertSushiLog);
|
||||
System.out.println("====> Inserted into sushilog");
|
||||
|
||||
stmt.close();
|
||||
ConnectDB.getConnection().commit();
|
||||
ConnectDB.getConnection().close();
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ public class UsageStatsExporter {
|
|||
// log.info("irus done");
|
||||
|
||||
SarcStats sarcStats = new SarcStats();
|
||||
sarcStats.getAndProcessSarc(sarcsReportPathArray, sarcsReportPathNonArray);
|
||||
// sarcStats.sarcStats();
|
||||
log.info("sarc done");
|
||||
// sarcStats.getAndProcessSarc(sarcsReportPathArray, sarcsReportPathNonArray);
|
||||
// sarcStats.finalizeSarcStats();
|
||||
// log.info("sarc done");
|
||||
|
||||
// // finalize usagestats
|
||||
// piwikstatsdb.finalizeStats();
|
||||
|
|
Loading…
Reference in New Issue