From 946be1e750aa7c11d583a005b1cb3e986e08df01 Mon Sep 17 00:00:00 2001 From: Pablo Tamarit Date: Mon, 14 Oct 2024 14:01:35 +0200 Subject: [PATCH] awards: rollback to use the 2nd part of funding stream as program --- invenio_vocabularies/contrib/awards/datastreams.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/invenio_vocabularies/contrib/awards/datastreams.py b/invenio_vocabularies/contrib/awards/datastreams.py index 9ed455c8..0310bb4c 100644 --- a/invenio_vocabularies/contrib/awards/datastreams.py +++ b/invenio_vocabularies/contrib/awards/datastreams.py @@ -74,7 +74,10 @@ def apply(self, stream_entry, **kwargs): funding = next(iter(record.get("funding", [])), None) if funding: - program = funding.get("fundingStream", {}).get("id", "") + funding_stream_id = funding.get("fundingStream", {}).get("id", "") + # Example funding stream ID: `EC::HE::HORIZON-AG-UN`. We need the `HE` + # string, i.e. the second "part" of the identifier. + program = next(iter(funding_stream_id.split("::")[1:2]), "") if program: award["program"] = program