Skip to content

Commit

Permalink
Fix output result metadata (#65)
Browse files Browse the repository at this point in the history
* bugfix: refactored variable name for associated works in task_output_results was not propogated to task_maintenance_metadata.

* Updated github action.

* dependabot version bump. Updated postgres in github action.

* bumped postgres in docker-compose.

* fixed erroneous correction of update_citation_target_metadata.
  • Loading branch information
tjacovich committed May 16, 2023
1 parent e83d2c2 commit a7f8d4b
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 16 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Python CI actions

on: [pull_request]
on:
push:
branches:
- main
pull_request:
env:
PGDATABASE: citation_capture_pipeline_test
PGPASSWORD: postgres
Expand All @@ -15,7 +19,7 @@ jobs:

services:
postgres:
image: postgres:9.6
image: postgres:14.0
env:
POSTGRES_DB: citation_capture_pipeline_test
POSTGRES_PASSWORD: postgres
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
8 changes: 1 addition & 7 deletions ADSCitationCapture/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,7 @@ def _parse_metadata_zenodo_doi(raw_metadata):
parsed_metadata['bibcode'] = bibcode
return parsed_metadata

def fetch_all_versions_doi(base_doi_url, base_datacite_url, parsed_metadata):
"""
Takes zenodo parsed metadata and fetches DOI for all versions of zenodo repository
"""
return _fetch_all_versions_doi(base_doi_url, base_datacite_url, parsed_metadata)

def _fetch_all_versions_doi(base_doi_url, base_datacite_url, parsed_metadata):
def fetch_all_versions_doi(base_doi_url, base_datacite_url, parsed_metadata):
"""
Takes zenodo parsed metadata and fetches DOI for base repository as well as DOI for all versions.
"""
Expand Down
8 changes: 4 additions & 4 deletions ADSCitationCapture/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def task_process_updated_citation(citation_change, force=False):
original_citations = db.get_citations_by_bibcode(app, citation_target_bibcode)
citations = api.get_canonical_bibcodes(app, original_citations)
logger.debug("Calling 'task_output_results' with '%s'", citation_change)
task_output_results.delay(citation_change, parsed_metadata, citations, db_versions = no_self_ref_versions, readers=readers)
task_output_results.delay(citation_change, parsed_metadata, citations, db_versions=no_self_ref_versions, readers=readers)
logger.debug("Calling '_emit_citation_change' with '%s'", citation_change)
_emit_citation_change(citation_change, parsed_metadata)

Expand Down Expand Up @@ -659,7 +659,7 @@ def task_maintenance_metadata(dois, bibcodes, reset=False):
citations = api.get_canonical_bibcodes(app, original_citations)
readers = db.get_citation_target_readers(app, registered_record['bibcode'], parsed_metadata.get('alternate_bibcode', []))
logger.debug("Calling 'task_output_results' with '%s'", citation_change)
task_output_results.delay(citation_change, modified_metadata, citations, bibcode_replaced=bibcode_replaced, associated=registered_record.get('associated_works', {"":""}), readers=readers)
task_output_results.delay(citation_change, modified_metadata, citations, bibcode_replaced=bibcode_replaced, db_versions=registered_record.get('associated_works', {"":""}), readers=readers)

@app.task(queue='maintenance_metadata')
def task_maintenance_curation(dois, bibcodes, curated_entries, reset=False):
Expand Down Expand Up @@ -821,7 +821,7 @@ def task_maintenance_curation(dois, bibcodes, curated_entries, reset=False):
citations = api.get_canonical_bibcodes(app, original_citations)
readers = db.get_citation_target_readers(app, registered_record['bibcode'], parsed_metadata.get('alternate_bibcode', []))
logger.debug("Calling 'task_output_results' with '%s'", citation_change)
task_output_results.delay(citation_change, modified_metadata, citations, bibcode_replaced=bibcode_replaced, associated=registered_record.get('associated_works', {"":""}), readers=readers)
task_output_results.delay(citation_change, modified_metadata, citations, bibcode_replaced=bibcode_replaced, db_versions=registered_record.get('associated_works', {"":""}), readers=readers)
else:
logger.warn("Curated metadata did not result in a change to recorded metadata for {}.".format(registered_record.get('content')))
except Exception as e:
Expand Down Expand Up @@ -940,7 +940,7 @@ def task_maintenance_resend(dois, bibcodes, broker, only_nonbib=False):
# Only update master
readers = db.get_citation_target_readers(app, parsed_metadata.get('bibcode',''), parsed_metadata.get('alternate_bibcode', []))
logger.debug("Calling 'task_output_results' with '%s'", custom_citation_change)
task_output_results.delay(custom_citation_change, parsed_metadata, citations, db_versions = registered_record.get('associated_works',{"":""}), readers=readers, only_nonbib=only_nonbib)
task_output_results.delay(custom_citation_change, parsed_metadata, citations, db_versions=registered_record.get('associated_works',{"":""}), readers=readers, only_nonbib=only_nonbib)

else:
# Only re-emit to the broker
Expand Down

0 comments on commit a7f8d4b

Please sign in to comment.