fixed the irish result subset

This commit is contained in:
Antonis Lempesis 2024-03-07 14:08:57 +02:00
parent 5ae4b4286c
commit 3c79720342
1 changed files with 17 additions and 6 deletions

View File

@ -27,12 +27,23 @@ select distinct xpath_string(fundingtree[0].value, '//funder/name') as funder fr
drop table if exists TARGET.result; drop table if exists TARGET.result;
create table TARGET.result stored as parquet as create table TARGET.result stored as parquet as
select distinct * from SOURCE.result r where r.id in (select ro.id from SOURCE.result_organization ro select distinct * from (
left outer join SOURCE.organization o on o.id=ro.organization select r.*
left outer join SOURCE.result_projects rp on rp.id=ro.id from SOURCE.result r
left outer join SOURCE.project p on p.id=rp.project join SOURCE.result_projects rp on rp.id=r.id
join TARGET.irish_funders irf join SOURCE.project p on p.id=rp.project
where o.country='IE' or p.funder=irf.funder); join openaire_prod_stats_monitor_ie_20231226b.irish_funders irf on irf.funder=p.funder
union all
select r.*
from SOURCE.result r
join SOURCE.result_organization ro on ro.id=r.id
join SOURCE.organization o on o.id=ro.organization and o.country='IE'
union all
select r.*
from SOURCE.result r
join SOURCE.result_pids pid on pid.id=r.id
join stats_ext.transformative_facts tf on tf.doi=pid.pid
) foo;
create view if not exists TARGET.category as select * from SOURCE.category; create view if not exists TARGET.category as select * from SOURCE.category;
create view if not exists TARGET.concept as select * from SOURCE.concept; create view if not exists TARGET.concept as select * from SOURCE.concept;