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