Skip to content

Commit

Permalink
Dynamically create summary for UNFCCC (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
diversemix authored May 30, 2023
1 parent aba0a5f commit 7901ce9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/core/ingestion/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def build_params_from_unfccc(row: UNFCCCDocumentIngestRow) -> IngestParameters:
def add_metadata(db: Session, import_id: str, taxonomy: Taxonomy, taxonomy_id: int):
add_unfccc_metadata(db, import_id, taxonomy, taxonomy_id, row)

def build_summary() -> str:
start = f"{row.family_name}, {row.submission_type}"
return f"{start} from {row.author} in {row.date.year}"

return IngestParameters(
create_collections=False,
add_metadata=add_metadata,
Expand All @@ -99,7 +103,7 @@ def add_metadata(db: Session, import_id: str, taxonomy: Taxonomy, taxonomy_id: i
collection_summary="",
document_title=row.document_title,
family_name=row.family_name,
family_summary=row.family_summary,
family_summary=build_summary(),
document_role=row.document_role,
document_variant=row.document_variant,
geography_iso=parse_csv_geography(row.geography_iso),
Expand Down
2 changes: 1 addition & 1 deletion tests/routes/test_admin_unfccc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"UNFCCC.Document.1.0": {
"publication_ts": "2021-10-25T00:00:00+00:00",
"name": "Nationally determined contributions under the Paris Agreement. Revised note by the secretariat",
"description": "summary",
"description": "Nationally determined contributions under the Paris Agreement. Revised note by the secretariat, Synthesis Report from UNFCCC Secretariat in 2021",
"postfix": null,
"source_url": "https://unfccc.int/sites/default/files/resource/cma2021_08r01_S.pdf",
"download_url": "url of downloaded document",
Expand Down

0 comments on commit 7901ce9

Please sign in to comment.