diff options
| author | Bryan Newbold <bnewbold@robocracy.org> | 2020-11-06 19:16:31 -0800 | 
|---|---|---|
| committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-11-06 19:16:31 -0800 | 
| commit | b1b34d44ce1a416ee70be665b71b99ba9f98d9a3 (patch) | |
| tree | 7ecd5b8478a12aad48b26517360bde2a54e9c977 /python/fatcat_tools | |
| parent | f32ff2bd5ab1dba1dc3108b75b28ce4090d9c00f (diff) | |
| download | fatcat-b1b34d44ce1a416ee70be665b71b99ba9f98d9a3.tar.gz fatcat-b1b34d44ce1a416ee70be665b71b99ba9f98d9a3.zip  | |
ingest tool: support for setting ingest type
Diffstat (limited to 'python/fatcat_tools')
| -rw-r--r-- | python/fatcat_tools/transforms/ingest.py | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/python/fatcat_tools/transforms/ingest.py b/python/fatcat_tools/transforms/ingest.py index 2f4e2271..59831017 100644 --- a/python/fatcat_tools/transforms/ingest.py +++ b/python/fatcat_tools/transforms/ingest.py @@ -15,15 +15,19 @@ def release_ingest_request(release, ingest_request_source='fatcat', ingest_type=      if release.state != 'active':          return None +    # TODO: infer ingest type based on release_type or container metadata? +    if not ingest_type: +        ingest_type = 'pdf' +      # generate a URL where we expect to find fulltext      url = None      link_source = None      link_source_id = None -    if release.ext_ids.arxiv: +    if release.ext_ids.arxiv and ingest_type == "pdf":          url = "https://arxiv.org/pdf/{}.pdf".format(release.ext_ids.arxiv)          link_source = "arxiv"          link_source_id = release.ext_ids.arxiv -    elif release.ext_ids.pmcid: +    elif release.ext_ids.pmcid and ingest_type == "pdf":          # TODO: how to tell if an author manuscript in PMC vs. published?          #url = "https://www.ncbi.nlm.nih.gov/pmc/articles/{}/pdf/".format(release.ext_ids.pmcid)          url = "http://europepmc.org/backend/ptpmcrender.fcgi?accid={}&blobtype=pdf".format(release.ext_ids.pmcid) @@ -40,10 +44,6 @@ def release_ingest_request(release, ingest_request_source='fatcat', ingest_type=      ext_ids = release.ext_ids.to_dict()      ext_ids = dict([(k, v) for (k, v) in ext_ids.items() if v]) -    # TODO: infer ingest type based on release_type or container metadata? -    if not ingest_type: -        ingest_type = 'pdf' -      ingest_request = {          'ingest_type': ingest_type,          'ingest_request_source': ingest_request_source,  | 
