Skip to content

Commit

Permalink
formatting all dates in enrich
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjeangirard committed Sep 24, 2021
1 parent 69fcd2c commit 919be93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bso/server/main/unpaywall_enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pandas as pd

from typing import Union
import dateutil.parser

from bso.server.main.apc.apc_detect import detect_apc
from bso.server.main.field_detect import detect_fields
Expand Down Expand Up @@ -191,4 +192,8 @@ def enrich(publications: list) -> list:
new_updated = format_upw(dois_infos=data, extra_data=publis_dict)
all_updated += [d for d in new_updated if len(d.get('oa_details', {})) > 0]
logger.debug(f'{len(publi_chunk)} / {len(publications)} enriched')
for p in all_updated:
for field in p:
if '_date' in field and p.get(field):
p[field] = dateutil.parser.parse(p[field]).isoformat()
return all_updated

1 comment on commit 919be93

@annelhote
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See issue #12

Please sign in to comment.