Skip to content

Commit

Permalink
awards: rollback to use the 2nd part of funding stream as program
Browse files Browse the repository at this point in the history
  • Loading branch information
ptamarit committed Oct 15, 2024
1 parent 0903904 commit 307728d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion invenio_vocabularies/contrib/awards/datastreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/contrib/awards/test_awards_datastreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def expected_from_award_json():
"id": "021nxhr62::0751743",
"identifiers": [{"identifier": "https://test.com", "scheme": "url"}],
"number": "0751743",
"program": "NSF::GEO/OAD::GEO/OCE",
"program": "GEO/OAD",
"title": {"en": "Test title"},
"funder": {"id": "021nxhr62"},
"acronym": "TA",
Expand All @@ -110,7 +110,7 @@ def expected_from_award_json_ec():
"title": {"en": "Test title"},
"funder": {"id": "00k4n6c32"},
"acronym": "TS",
"program": "TST::test::test",
"program": "test",
}


Expand Down

0 comments on commit 307728d

Please sign in to comment.