1- -- Publication statistics for institutions participating in transformative agreements (TA)
2- -- The resulting table allows us to determine the impact TAs have on the open access publication activity of participating institutions.
1+ -- Combine ESAC TA data with institution information
2+ WITH esac_journals AS (
3+ SELECT DISTINCT
4+ hybrid_jns .issn_l AS matching_issn,
5+ hybrid_jns .esac_id ,
6+ esac_publisher,
7+ start_date,
8+ EXTRACT(YEAR FROM start_date) AS start_year,
9+ end_date,
10+ EXTRACT(YEAR FROM end_date) AS end_year,
11+ issn_l,
12+ jct_inst .ror ,
13+ jct_inst .ror_type ,
14+ oalex .id AS oalex_inst_id
15+ FROM ` subugoe-collaborative.hoaddata.jct_hybrid_jns` AS hybrid_jns
16+ -- Join with participating institutions
17+ INNER JOIN ` subugoe-collaborative.hoaddata.jct_inst_enriched` AS jct_inst
18+ ON jct_inst .esac_id = hybrid_jns .esac_id
19+ -- Match with OpenAlex institutions
20+ INNER JOIN ` subugoe-collaborative.openalex.institutions` AS oalex
21+ ON jct_inst .ror = oalex .ror
22+ ),
323
4- WITH
5- -- ESAC TA / institutions matching table
6- esac_journals AS (
7- SELECT
8- DISTINCT hybrid_jns .issn_l AS matching_issn, -- Extracting ISSN
9- hybrid_jns .esac_id , -- ESAC ID of the TA
10- esac_publisher, -- Publisher information
11- start_date, -- Agreement start date
12- EXTRACT(YEAR FROM start_date) AS start_year, -- Extracting the year from start_date
13- end_date, -- Agreement end date
14- EXTRACT(YEAR FROM end_date) AS end_year, -- Extracting the year from end_date
15- issn_l, -- ISSN of the journal
16- jct_inst .ror , -- ROR ID of the institution
17- jct_inst .ror_main , -- Main ROR ID of the institution
18- oalex .id AS oalex_inst_id -- OpenAlex institution ID
19- FROM
20- ` subugoe-collaborative.hoaddata.jct_hybrid_jns` AS hybrid_jns
21- -- Join with participating institutions
22- INNER JOIN
23- ` subugoe-collaborative.hoaddata.jct_inst_enriched` AS jct_inst
24- ON
25- jct_inst .esac_id = hybrid_jns .esac_id
26- -- OpenAlex / ROR Matching
27- INNER JOIN
28- ` subugoe-collaborative.openalex.institutions` AS oalex
29- ON
30- jct_inst .ror = oalex .ror
31- ),
24+ -- Gather publication data for institutions per year and link to TA
25+ inst_per_year AS (
26+ SELECT DISTINCT
27+ esac_journals.* ,
28+ oalex_inst .doi ,
29+ oalex_inst .cr_year ,
30+ oa .cc ,
31+ cr .issued ,
32+ esac_journals .ror as ror_matched,
33+ esac_journals .ror_type as ror_type_,
34+ -- Determine if publication is within TA date range
35+ CASE
36+ WHEN (DATE (cr .issued ) BETWEEN DATE (start_date) AND DATE (end_date)) THEN TRUE
37+ ELSE FALSE
38+ END AS ta,
39+ -- Check if publication has a CC license
40+ CASE
41+ WHEN oa .cc IS NOT NULL THEN TRUE
42+ ELSE FALSE
43+ END AS has_cc
44+ FROM esac_journals
45+ -- Join with OpenAlex institution data
46+ INNER JOIN ` subugoe-collaborative.hoaddata.cr_openalex_inst_full` AS oalex_inst
47+ ON esac_journals .oalex_inst_id = oalex_inst .id
48+ AND oalex_inst .issn_l = esac_journals .matching_issn
49+ -- Left join to include publications without CC licenses
50+ LEFT JOIN ` subugoe-collaborative.hoaddata.cc_openalex_inst` AS oa
51+ ON oalex_inst .doi = oa .doi
52+ -- Join with Crossref data for publication dates
53+ INNER JOIN ` subugoe-collaborative.cr_instant.snapshot` AS cr
54+ ON oalex_inst .doi = cr .doi
55+ )
3256
33- -- Publications per year, institution, and agreement
34- inst_per_year AS (
35- SELECT
36- DISTINCT esac_journals.* , -- Include columns from the previous CTE
37- oalex_inst .doi , -- DOI of the publication
38- oalex_inst .cr_year , -- Publication year
39- cc, -- CC license information
40- cr .issued , -- Date of publication
41- esac_journals .ror AS ror_rel, -- ROR ID related to the journal
42- esac_journals .ror_main AS ror_id, -- Main ROR ID related to the journal
43- CASE
44- WHEN (DATE (cr .issued ) BETWEEN DATE (start_date) AND DATE (end_date)) THEN TRUE -- Check if publication is within the agreement's date range
45- ELSE FALSE
46- END AS ta, -- Flag indicating if the publication is within the agreement
47- CASE
48- WHEN cc IS NOT NULL THEN TRUE -- Check if the publication has a CC license
49- ELSE FALSE
50- END AS has_cc -- Flag indicating if the publication has a CC license
51- FROM
52- esac_journals
53- INNER JOIN
54- ` subugoe-collaborative.hoaddata.cr_openalex_inst_full` AS oalex_inst
55- ON
56- esac_journals .oalex_inst_id = oalex_inst .id
57- AND oalex_inst .issn_l = esac_journals .matching_issn
58- LEFT JOIN
59- ` subugoe-collaborative.hoaddata.cc_openalex_inst` AS oa
60- ON
61- oalex_inst .doi = oa .doi
62- INNER JOIN
63- ` subugoe-collaborative.cr_instant.snapshot` AS cr
64- ON
65- oalex_inst .doi = cr .doi
66- )
67-
68- -- Selecting relevant columns for the final result
69- SELECT
57+ -- Final query to select relevant columns for analysis
58+ SELECT DISTINCT
7059 doi,
7160 cr_year,
7261 matching_issn AS issn_l,
7362 esac_id AS ta_journal_portfolio,
7463 esac_publisher,
7564 ta AS ta_active,
7665 cc,
77- ror_rel AS ror_matching,
78- ror_id AS ror_main
79- FROM
80- inst_per_year
81- -- Ordering the result set
66+ ror_matched as ror,
67+ ror_type_ as ror_type
68+ FROM inst_per_year
69+ -- Order results by TA journal portfolio, publication year (descending) and DOI
8270ORDER BY
8371 ta_journal_portfolio,
84- cr_year DESC ;
72+ cr_year DESC ,
73+ doi
0 commit comments