diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/fatcat_tools/importers/common.py | 12 | ||||
| -rw-r--r-- | python/fatcat_tools/importers/datacite.py | 12 | ||||
| -rw-r--r-- | python/fatcat_tools/importers/ingest.py | 7 | ||||
| -rw-r--r-- | python/fatcat_tools/importers/pubmed.py | 1 | ||||
| -rw-r--r-- | python/fatcat_tools/workers/elasticsearch.py | 15 | ||||
| -rw-r--r-- | python/fatcat_web/routes.py | 4 | ||||
| -rw-r--r-- | python/fatcat_web/templates/container_search.html | 89 | ||||
| -rw-r--r-- | python/fatcat_web/templates/container_view.html | 2 | ||||
| -rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 78 | ||||
| -rw-r--r-- | python/fatcat_web/templates/release_search.html | 59 | ||||
| -rw-r--r-- | python/fatcat_web/templates/release_view.html | 12 | ||||
| -rw-r--r-- | python/tests/files/datacite/datacite_doc_31.json | 53 | ||||
| -rw-r--r-- | python/tests/files/datacite/datacite_doc_32.json | 53 | ||||
| -rw-r--r-- | python/tests/files/datacite/datacite_result_31.json | 24 | ||||
| -rw-r--r-- | python/tests/files/datacite/datacite_result_32.json | 23 | ||||
| -rw-r--r-- | python/tests/import_datacite.py | 2 | 
16 files changed, 336 insertions, 110 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index 99c330a6..eafc6546 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -458,7 +458,8 @@ class EntityImporter:              creator_id = rv.ident          except ApiException as ae:              # If anything other than a 404 (not found), something is wrong -            assert ae.status == 404 +            if ae.status != 404: +                raise ae          self._orcid_id_map[orcid] = creator_id # might be None          return creator_id @@ -479,7 +480,8 @@ class EntityImporter:              release_id = rv.ident          except ApiException as ae:              # If anything other than a 404 (not found), something is wrong -            assert ae.status == 404 +            if ae.status != 404: +                raise ae          self._doi_id_map[doi] = release_id # might be None          return release_id @@ -495,7 +497,8 @@ class EntityImporter:              release_id = rv.ident          except ApiException as ae:              # If anything other than a 404 (not found), something is wrong -            assert ae.status == 404 +            if ae.status != 404: +                raise ae          self._pmid_id_map[pmid] = release_id # might be None          return release_id @@ -512,7 +515,8 @@ class EntityImporter:              container_id = rv.ident          except ApiException as ae:              # If anything other than a 404 (not found), something is wrong -            assert ae.status == 404 +            if ae.status != 404: +                raise ae          self._issnl_id_map[issnl] = container_id # might be None          return container_id diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index 81f00876..d998f266 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -496,10 +496,12 @@ class DataciteImporter(EntityImporter):              if not desc.get('descriptionType') == 'Abstract':                  continue -            # Description maybe a string or list. +            # Description maybe a string, int or list.              text = desc.get('description', '')              if not text:                  continue +            if isinstance(text, int): +                text = '{}'.format(text)              if isinstance(text, list):                  try:                      text = "\n".join(text) @@ -758,6 +760,14 @@ class DataciteImporter(EntityImporter):                      given_name = clean(given_name)                  if surname:                      surname = clean(surname) + +                # Perform a final assertion that name does not reduce to zero +                # (e.g. whitespace only name). +                if name: +                    name = name.strip() +                if not name: +                    continue +                  if raw_affiliation == '':                      continue diff --git a/python/fatcat_tools/importers/ingest.py b/python/fatcat_tools/importers/ingest.py index 4772bfaa..6cf1604b 100644 --- a/python/fatcat_tools/importers/ingest.py +++ b/python/fatcat_tools/importers/ingest.py @@ -19,6 +19,7 @@ class IngestFileResultImporter(EntityImporter):              editgroup_description=eg_desc,              editgroup_extra=eg_extra,              **kwargs) +        self.use_glutton_match = False          self.default_link_rel = kwargs.get("default_link_rel", "web")          assert self.default_link_rel          self.require_grobid = require_grobid @@ -107,9 +108,10 @@ class IngestFileResultImporter(EntityImporter):                      elif err.status == 400:                          self.counts['warn-extid-invalid'] += 1                          continue +                    raise err                  release_ident = release.ident                  break -        if not release_ident and row.get('grobid'): +        if self.use_glutton_match and not release_ident and row.get('grobid'):              # try biblio-glutton extracted hit              if row['grobid'].get('fatcat_release'):                  release_ident = row['grobid']['fatcat_release'].split('_')[-1] @@ -197,8 +199,7 @@ class IngestFileResultImporter(EntityImporter):          if not existing:              return True -        # the following checks all assume there is an existing item - +        # NOTE: the following checks all assume there is an existing item          if (fe.release_ids[0] in existing.release_ids) and existing.urls:              # TODO: could still, in theory update with the new URL?              self.counts['exists'] += 1 diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py index abcb21d9..3d3e3a8c 100644 --- a/python/fatcat_tools/importers/pubmed.py +++ b/python/fatcat_tools/importers/pubmed.py @@ -782,6 +782,7 @@ class PubmedImporter(EntityImporter):                  # NOTE: API behavior might change in the future?                  if "release_edit_editgroup_id_ident_id_key" in err.body:                      self.counts['skip-update-conflict'] += 1 +                    return False                  else:                      raise err              finally: diff --git a/python/fatcat_tools/workers/elasticsearch.py b/python/fatcat_tools/workers/elasticsearch.py index 525f372b..e58b3da1 100644 --- a/python/fatcat_tools/workers/elasticsearch.py +++ b/python/fatcat_tools/workers/elasticsearch.py @@ -19,7 +19,7 @@ class ElasticsearchReleaseWorker(FatcatWorker):      def __init__(self, kafka_hosts, consume_topic, poll_interval=10.0, offset=None,              elasticsearch_backend="http://localhost:9200", elasticsearch_index="fatcat", -            batch_size=200): +            batch_size=200, api_host="https://api.fatcat.wiki/v0"):          super().__init__(kafka_hosts=kafka_hosts,                           consume_topic=consume_topic)          self.consumer_group = "elasticsearch-updates3" @@ -30,9 +30,11 @@ class ElasticsearchReleaseWorker(FatcatWorker):          self.entity_type = ReleaseEntity          self.elasticsearch_document_name = "release"          self.transform_func = release_to_elasticsearch +        self.api_host = api_host      def run(self):          ac = ApiClient() +        api = public_api(self.api_host)          def fail_fast(err, partitions):              if err is not None: @@ -103,13 +105,20 @@ class ElasticsearchReleaseWorker(FatcatWorker):                      if entity_dict.get('name') and not entity_dict.get('title'):                          continue                  entity = entity_from_json(json_str, self.entity_type, api_client=ac) +                if self.elasticsearch_document_name == "changelog": +                    key = entity.index +                    # might need to fetch from API +                    if not (entity.editgroup and entity.editgroup.editor): +                        entity = api.get_changelog_entry(entity.index) +                else: +                    key = entity.ident                  # TODO: handle deletions from index                  bulk_actions.append(json.dumps({ -                    "index": { "_id": entity.ident, }, +                    "index": { "_id": key, },                  }))                  bulk_actions.append(json.dumps(                      self.transform_func(entity))) -            print("Upserting, eg, {} (of {} releases in elasticsearch)".format(entity.ident, len(batch))) +            print("Upserting, eg, {} (of {} {} in elasticsearch)".format(key, len(batch), self.elasticsearch_document_name))              elasticsearch_endpoint = "{}/{}/{}/_bulk".format(                  self.elasticsearch_backend,                  self.elasticsearch_index, diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 8583d255..58f4b7e0 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -707,6 +707,8 @@ def generic_search():  def release_search():      query = request.args.get('q') +    if not query: +        query = '*'      fulltext_only = bool(request.args.get('fulltext_only'))      issnl = request.args.get('container_issnl') @@ -731,6 +733,8 @@ def release_search():  def container_search():      query = request.args.get('q') +    if not query: +        query = '*'      offset = request.args.get('offset', '0')      offset = max(0, int(offset)) if offset.isnumeric() else 0 diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html index 1a089643..1a804595 100644 --- a/python/fatcat_web/templates/container_search.html +++ b/python/fatcat_web/templates/container_search.html @@ -9,6 +9,7 @@  {% endif %}  {% endblock %} +  {% block fullmain %}  <div class="ui vertical stripe segment" style="background-color: #EEE; padding-top: 4.5em;"> @@ -17,8 +18,7 @@      <form class="" role="search" action="/container/search" method="get">        <div class="ui form">          <div class="ui action input huge fluid"> -          <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search container metadata"> -          <button class="ui button">Search</button> +          <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search container metadata"> <button class="ui button">Search</button>          </div>          <br>Can also lookup by <b><a href="/container/lookup">identifier</a></b> or search <b><a href="/release/search?q={{ query or "" }}">releases</a></b>.        </div> @@ -30,49 +30,56 @@  <br>  {% if found %} -{% if found.results %} -  {{ entity_macros.top_results(found) }} +  {% if found.results %} -{% for entity in found.results %} -<div> -  <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;"> -    <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a> -    {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %} -  </h4> -  {% if entity.publisher %} -    <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5> -  {% endif %} -  {% if entity.issnl %} -    <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a> -  {% endif %} -  {% if entity.container_type %} -   {{ entity.container_type }} -  {% endif %} -</div> -{% endfor %} -{% if found.results|length > 8 %} -  <div class="ui divider"></div> -  <div style="text-align: center"> -  {{ entity_macros.bottom_results(found, endpoint='container_search')}} -  </div> -{% endif %} -{% else %} +    {{ entity_macros.top_results(found) }} -Raw query was: <i>{{ found.query.q }}</i> +    {% for entity in found.results %} +      <div> +        <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;"> +          <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a> +          {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %} +        </h4> +        {% if entity.publisher %} +          <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5> +        {% endif %} +        {% if entity.issnl %} +          <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a> +        {% endif %} +        {% if entity.container_type %} +           {{ entity.container_type }} +        {% endif %} +      </div> +    {% endfor %} + +    {% if found.results|length > 8 %} +      <div class="ui divider"></div> +      <div style="text-align: center"> +      {{ entity_macros.bottom_results(found, endpoint='container_search') }} +      </div> +    {% endif %} -<div class="ui centered stackable grid" style="padding-top: 15%;"> -  <div class="row"> -    <div class="four wide column"> -      <img src="/static/paper_man_confused.gif" alt="confused paper man"> +  {% else %} + +    Raw query was: <i>{{ found.query.q }}</i> + +    <div class="ui centered stackable grid" style="padding-top: 15%;"> +      <div class="row"> +        <div class="four wide column"> +          <img src="/static/paper_man_confused.gif" alt="confused paper man"> +        </div> +        <div class="six wide column"> +          <h2>No results found!</h2> +          <p>You could try elsewhere:</p> +          <ul> +            <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> +          </ul> +        </div> +      </div>      </div> -    <div class="six wide column"> -  <h2>No results found!</h2> -  <p>You could try elsewhere:</p> -  <ul> -    <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> -  </ul> -</div> -{% endif %} + +  {% endif %} +  {% endif %}  </div> diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index 8d7c4cae..cf444956 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -23,6 +23,7 @@    Published by {{ container.publisher }}  {% endif %} +{% if container.state == "active" %}  <h3>Search Releases from this Container</h3>  <form class="" role="search" action="/release/search" method="get">    <div class="ui form"> @@ -33,6 +34,7 @@      </div>    </div>  </form> +{% endif %}  {% if container._random_releases %}  <h3>Example Publications</h3> diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 7c5436c6..c22eb106 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -54,10 +54,12 @@    </a>  </div> +{% if entity.ident %}  <div class="two ui buttons bottom attached">    <a href="{% if editgroup %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/{{ entity_type }}/{{ entity.ident }}/edit" class="ui blue button">Edit Metadata</a>    <a href="/{{ entity_type }}/{{ entity.ident }}/history" class="ui button">View History</a>  </div> +{% endif %}  {%- endmacro %} @@ -156,17 +158,35 @@          [blank]        {% endif %}      </a> + +    {# release type suffix #} +    {% if paper.release_type in ("article-journal", "paper-conference") %} +      {# pass #} +    {% elif paper.release_type in ("book", "chapter", "dataset") %} +      <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b> +    {% elif not paper.release_type %} +      <b style="text-transform: uppercase; color: black;">[unknown-media]</b> +    {% else %} +      <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b> +    {% endif %} + +    {# show original_title #} +    {% if paper.original_title and paper.title != paper.original_title %} +      <br> +      <i style="font-weight: normal;"> +        {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} +      </i> +    {% endif %} +    </h4> +    {% if paper.best_pdf_url %}    <div style="float: right; padding: 4px;">      <a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a>    </div>    {% endif %} -  {# -  <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ ", ".join(paper.contrib_names[:12]) }} -    {% if paper.contrib_names|length > 12 %}<i>(+{{ paper.contrib_names|length - 12 }} others)</i>{% endif %} -  </h5> -  #} + +  {# ### AUTHOR ROW #}    {% if paper.contrib_names %}      <div style="margin-top: 0px; margin-bottom: 0px; font-size: 1em;">      <b> @@ -175,25 +195,14 @@      </b>      </div>    {% endif %} + + +  {# ### JOURNAL ROW #}    {% if paper.release_year %}      {{ paper.release_year }}    {% endif %} -  {% if paper.release_type %} -    {% if paper.release_type in ("article-journal", "paper-conference") %} -      <span class="ui black basic label small">{{ paper.release_type }}</span> -    {% elif paper.release_type in ("book") %} -      <span class="ui brown basic label small">{{ paper.release_type }}</span> -    {% else %} -      <span class="ui grey basic label small">{{ paper.release_type }}</span> -    {% endif %} -  {% endif %} -  {% if paper.withdrawn_status %} -    <span class="ui red label small">{{ paper.withdrawn_status }}</span> -  {% endif %} -  {% if paper.release_stage and paper.release_stage != "published" %} -    <span class="ui pink basic label small">{{ paper.release_stage }}</span> -  {% elif not paper.release_stage %} -    <span class="ui red basic label small">unknown</span> +  {% if paper.release_year and paper.container_name %} +    |    {% endif %}    {% if paper.container_name %}      {% if paper.container_id %} @@ -203,8 +212,22 @@      {% endif %}      {% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %}    {% endif %} -  {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} -  <br> +  {% if paper.withdrawn_status %} +    <b style="color: red;"><code>[{{ paper.withdrawn_status }}]</code></b> +  {% endif %} +  {% if paper.release_stage == "accepted" %} +    <b style="color: darkmagenta;"><code>[{{ paper.release_stage }} manuscript]</code></b> +  {% elif paper.release_stage == "submitted" %} +    <b style="color: magenta;"><code>[pre-print]</code></b> +  {% elif paper.release_stage and paper.release_stage != "published" %} +    <b style="color: magenta;"><code>[{{ paper.release_stage }}]</code></b> +  {% elif not paper.release_stage %} +    <b style="color: red;"><code>[unpublished?]</code></b> +  {% endif %} + +  {# ### IDENTIFIERS #} +  {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id or paper.pmcid %} +    <br>    {% endif %}    {% if paper.doi %}      <a href="https://doi.org/{{paper.doi }}" style="color: green;">doi:{{ paper.doi }}</a>   @@ -212,13 +235,18 @@    {% if paper.pmid %}      <a href="https://www.ncbi.nlm.nih.gov/pubmed/{{paper.pmid }}" style="color: green;">pmid:{{ paper.pmid }}</a>      {% endif %} +  {% if paper.pmcid %} +    <a href="https://pubmed.ncbi.nlm.nih.gov/{{paper.pmcid }}/" style="color: green;">pmcid:{{ paper.pmcid }}</a>   +  {% endif %}    {% if paper.arxiv_id %}      <a href="https://arxiv.org/abs/{{paper.arxiv_id }}" style="color: green;">arXiv:{{ paper.arxiv_id }}</a>      {% endif %} -  {% if False %} {# XXX: elastic release work grouping searches #} + +{# WIP: elastic release work grouping searches    <br>    <a href="/work/{{ paper.work_id }}"><i class="sitemap icon"></i> and 5 other versions of the same work!</a> -  {% endif %} +#} +  </div>  {% endmacro %} diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index 47f4330a..70c46c0a 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -35,37 +35,44 @@  <br>  {% if found %} -{% if found.results %} +  {% if found.results %} +      {{ entity_macros.top_results(found) }} -  {% for paper in found.results %} -  {{ entity_macros.release_search_result_row(paper) }} -{% endfor %} -{% if found.results|length > 8 %} -  <div class="ui divider"></div> -  <div style="text-align: center"> -  {{ entity_macros.bottom_results(found)}} -  </div> -{% endif %} -{% else %} +    {% for paper in found.results %} +      {{ entity_macros.release_search_result_row(paper) }} +    {% endfor %} + +    {% if found.results|length > 8 %} +      <div class="ui divider"></div> +      <div style="text-align: center"> +      {{ entity_macros.bottom_results(found, endpoint='release_search') }} +      </div> +    {% endif %} + +  {% else %} -Raw query was: <i>{{ found.query.q }}</i> +    Raw query was: <i>{{ found.query.q }}</i> -<div class="ui centered stackable grid" style="padding-top: 15%;"> -  <div class="row"> -    <div class="four wide column"> -      <img src="/static/paper_man_confused.gif" alt="confused paper man"> +    <div class="ui centered stackable grid" style="padding-top: 15%;"> +      <div class="row"> +        <div class="four wide column"> +          <img src="/static/paper_man_confused.gif" alt="confused paper man"> +        </div> +        <div class="six wide column"> +          <h2>No results found!</h2> +          <p>You could try elsewhere:</p> +          <ul> +            <li>Search <a href="https://dissem.in/search?q={{ found.query.q | urlencode }}">dissem.in</a></li> +            <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ found.query.q | urlencode }}">BASE</a></li> +            <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> +          </ul> +        </div> +      </div>      </div> -    <div class="six wide column"> -  <h2>No results found!</h2> -  <p>You could try elsewhere:</p> -  <ul> -    <li>Search <a href="https://dissem.in/search?q={{ found.query.q | urlencode }}">dissem.in</a></li> -    <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ found.query.q | urlencode }}">BASE</a></li> -    <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li> -  </ul> -</div> -{% endif %} + +  {% endif %} +  {% endif %}  </div> diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index d7c4e76e..60e4624e 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -3,9 +3,9 @@  {% import "entity_macros.html" as entity_macros %}  {% extends "entity_base.html" %} -{# HTML metadata embeddings #} -{% if release and release.status == "active" %} -  {% block extra_head %} +{% block extra_head %} +  {% if release and release.state == "active" %} +    {# HTML metadata embeddings #}      <link rel="canonical" href="https://{{ config.FATCAT_DOMAIN }}/release/{{ entity.ident }}">      <meta name="twitter:card" content="summary"> @@ -70,8 +70,8 @@          <meta name="citation_pdf_url" content="{{ url.url }}">        {% endif %}      {% endfor %}{% endfor %} -  {% endblock %} -{% endif %} +  {% endif %} +{% endblock %}  {% block main_extra_attr %}itemscope itemtype="http://schema.org/ScholarlyArticle" itemid="#release"{% endblock %} @@ -388,7 +388,7 @@ accessible version.    <br>grouping other versions (eg, pre-print) and variants of this release  </div> -{% if release._can_citeproc %} +{% if release.state == "active" and release._can_citeproc %}  <div class="ui segment attached accordion">    <div class="title" style="padding: 0px;">      <i class="dropdown icon"></i><b>Cite This Release</b> diff --git a/python/tests/files/datacite/datacite_doc_31.json b/python/tests/files/datacite/datacite_doc_31.json new file mode 100644 index 00000000..83af3e4d --- /dev/null +++ b/python/tests/files/datacite/datacite_doc_31.json @@ -0,0 +1,53 @@ +{ +  "id": "10.17912/micropub.biology.000143", +  "type": "dois", +  "attributes": { +    "doi": "10.17912/micropub.biology.000143", +    "identifiers": null, +    "creators": [ +      { +        "raw_name": " ", +        "givenName": "", +        "familyName": "", +        "affiliation": [], +        "role": "author" +      } +    ], +    "titles": [ +      { +        "title": "Sample" +      } +    ], +    "publisher": "microPublication Biology", +    "publicationYear": 2019, +    "types": { +      "resourceTypeGeneral": "DataPaper" +    }, +    "relatedIdentifiers": [], +    "sizes": [], +    "formats": [], +    "version": null, +    "rightsList": [], +    "descriptions": [ +      { +        "description": "Biological liquid-liquid phase separation", +        "descriptionType": "Abstract" +      } +    ], +    "geoLocations": [], +    "fundingReferences": [], +    "url": "https://www.micropublication.org/journals/biology/micropub.biology.000143", +    "created": "2019-08-19T14:43:08.000Z", +    "registered": "2019-08-19T14:43:09.000Z", +    "published": "2019", +    "updated": "2019-11-09T12:32:02.000Z" +  }, +  "relationships": { +    "client": { +      "data": { +        "id": "caltech.micropub", +        "type": "clients" +      } +    } +  } +} diff --git a/python/tests/files/datacite/datacite_doc_32.json b/python/tests/files/datacite/datacite_doc_32.json new file mode 100644 index 00000000..7ea7e873 --- /dev/null +++ b/python/tests/files/datacite/datacite_doc_32.json @@ -0,0 +1,53 @@ +{ +  "id": "10.17912/micropub.biology.000143", +  "type": "dois", +  "attributes": { +    "doi": "10.17912/micropub.biology.000143", +    "identifiers": null, +    "creators": [ +      { +        "raw_name": " ", +        "givenName": "", +        "familyName": "", +        "affiliation": [], +        "role": "author" +      } +    ], +    "titles": [ +      { +        "title": "Sample" +      } +    ], +    "publisher": "microPublication Biology", +    "publicationYear": 2019, +    "types": { +      "resourceTypeGeneral": "DataPaper" +    }, +    "relatedIdentifiers": [], +    "sizes": [], +    "formats": [], +    "version": null, +    "rightsList": [], +    "descriptions": [ +      { +        "description": 1234567890, +        "descriptionType": "Abstract" +      } +    ], +    "geoLocations": [], +    "fundingReferences": [], +    "url": "https://www.micropublication.org/journals/biology/micropub.biology.000143", +    "created": "2019-08-19T14:43:08.000Z", +    "registered": "2019-08-19T14:43:09.000Z", +    "published": "2019", +    "updated": "2019-11-09T12:32:02.000Z" +  }, +  "relationships": { +    "client": { +      "data": { +        "id": "caltech.micropub", +        "type": "clients" +      } +    } +  } +} diff --git a/python/tests/files/datacite/datacite_result_31.json b/python/tests/files/datacite/datacite_result_31.json new file mode 100644 index 00000000..193104b0 --- /dev/null +++ b/python/tests/files/datacite/datacite_result_31.json @@ -0,0 +1,24 @@ +{ +  "abstracts": [ +    { +      "content": "Biological liquid-liquid phase separation", +      "lang": "fr", +      "mimetype": "text/plain" +    } +  ], +  "contribs": [], +  "ext_ids": { +    "doi": "10.17912/micropub.biology.000143" +  }, +  "extra": { +    "datacite": { +      "resourceTypeGeneral": "DataPaper" +    }, +    "container_name": "microPublication Biology" +  }, +  "refs": [], +  "release_stage": "published", +  "release_year": 2019, +  "publisher": "microPublication Biology", +  "title": "Sample" +} diff --git a/python/tests/files/datacite/datacite_result_32.json b/python/tests/files/datacite/datacite_result_32.json new file mode 100644 index 00000000..1a84a043 --- /dev/null +++ b/python/tests/files/datacite/datacite_result_32.json @@ -0,0 +1,23 @@ +{ +  "abstracts": [ +    { +      "content": "1234567890", +      "mimetype": "text/plain" +    } +  ], +  "contribs": [], +  "ext_ids": { +    "doi": "10.17912/micropub.biology.000143" +  }, +  "extra": { +    "datacite": { +      "resourceTypeGeneral": "DataPaper" +    }, +    "container_name": "microPublication Biology" +  }, +  "refs": [], +  "release_stage": "published", +  "release_year": 2019, +  "publisher": "microPublication Biology", +  "title": "Sample" +} diff --git a/python/tests/import_datacite.py b/python/tests/import_datacite.py index 15650375..c9210ea4 100644 --- a/python/tests/import_datacite.py +++ b/python/tests/import_datacite.py @@ -287,7 +287,7 @@ def test_datacite_conversions(datacite_importer):      for now.      """      datacite_importer.debug = True -    for i in range(31): +    for i in range(33):          src = 'tests/files/datacite/datacite_doc_{0:02d}.json'.format(i)          dst = 'tests/files/datacite/datacite_result_{0:02d}.json'.format(i)          with open(src, 'r') as f:  | 
