|
|
|
@ -123,6 +123,16 @@ UNION ALL
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM ${stats_db_name}.otherresearchproduct_topics;
|
|
|
|
|
|
|
|
|
|
create table ${stats_db_name}.result_fos stored as parquet as
|
|
|
|
|
with
|
|
|
|
|
lvl1 as (select id, topic from ${stats_db_name}.result_topics where topic like '__ %' and type='Fields of Science and Technology classification'),
|
|
|
|
|
lvl2 as (select id, topic from ${stats_db_name}.result_topics where topic like '____ %' and type='Fields of Science and Technology classification'),
|
|
|
|
|
lvl3 as (select id, topic from ${stats_db_name}.result_topics where topic like '______ %' and type='Fields of Science and Technology classification')
|
|
|
|
|
select lvl1.id, lvl1.topic as lvl1, lvl2.topic as lvl2, lvl3.topic as lvl3
|
|
|
|
|
from lvl1
|
|
|
|
|
join lvl2 on lvl1.id=lvl2.id and substr(lvl2.topic, 1, 2)=substr(lvl1.topic, 1, 2)
|
|
|
|
|
join lvl3 on lvl3.id=lvl1.id and substr(lvl3.topic, 1, 4)=substr(lvl2.topic, 1, 4);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE ${stats_db_name}.result_organization STORED AS PARQUET AS
|
|
|
|
|
SELECT substr(r.target, 4) AS id, substr(r.source, 4) AS organization
|
|
|
|
|
FROM ${openaire_db_name}.relation r
|
|
|
|
@ -134,4 +144,5 @@ CREATE TABLE ${stats_db_name}.result_projects STORED AS PARQUET AS
|
|
|
|
|
select pr.result AS id, pr.id AS project, datediff(p.enddate, p.startdate) AS daysfromend, pr.provenance as provenance
|
|
|
|
|
FROM ${stats_db_name}.result r
|
|
|
|
|
JOIN ${stats_db_name}.project_results pr ON r.id = pr.result
|
|
|
|
|
JOIN ${stats_db_name}.project_tmp p ON p.id = pr.id;
|
|
|
|
|
JOIN ${stats_db_name}.project_tmp p ON p.id = pr.id;
|
|
|
|
|
|
|
|
|
|