From 986ce7a38029f7fb20a51271f67d943678e17386 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 1 Apr 2020 21:29:56 -0700 Subject: first iteration of web interface Copied and tweaked from fatcat:python/fatcat_web LICENSE file for this repo is a TODO and will need to match that of fatcat. --- fatcat_covid19/templates/400.html | 13 +++ fatcat_covid19/templates/404.html | 9 ++ fatcat_covid19/templates/500.html | 13 +++ fatcat_covid19/templates/about_de.html | 13 +++ fatcat_covid19/templates/about_en.html | 13 +++ fatcat_covid19/templates/base.html | 106 +++++++++++++++++++++++ fatcat_covid19/templates/entity_macros.html | 117 +++++++++++++++++++++++++ fatcat_covid19/templates/fulltext_search.html | 72 ++++++++++++++++ fatcat_covid19/templates/home.html | 94 ++++++++++++++++++++ fatcat_covid19/templates/sources.html | 119 ++++++++++++++++++++++++++ 10 files changed, 569 insertions(+) create mode 100644 fatcat_covid19/templates/400.html create mode 100644 fatcat_covid19/templates/404.html create mode 100644 fatcat_covid19/templates/500.html create mode 100644 fatcat_covid19/templates/about_de.html create mode 100644 fatcat_covid19/templates/about_en.html create mode 100644 fatcat_covid19/templates/base.html create mode 100644 fatcat_covid19/templates/entity_macros.html create mode 100644 fatcat_covid19/templates/fulltext_search.html create mode 100644 fatcat_covid19/templates/home.html create mode 100644 fatcat_covid19/templates/sources.html (limited to 'fatcat_covid19/templates') diff --git a/fatcat_covid19/templates/400.html b/fatcat_covid19/templates/400.html new file mode 100644 index 0000000..f2659ca --- /dev/null +++ b/fatcat_covid19/templates/400.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% block body %} + +
+
400
+
Bad Request
+ +

Wasn't able to handle the request, either due to incorrect or unexpected +input. Usually more context should be available; if you hit this page it means +you've discovered a new corner case! +

+ +{% endblock %} diff --git a/fatcat_covid19/templates/404.html b/fatcat_covid19/templates/404.html new file mode 100644 index 0000000..653b8ee --- /dev/null +++ b/fatcat_covid19/templates/404.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} +{% block body %} + +
+
404
+
Not Found
+
+ +{% endblock %} diff --git a/fatcat_covid19/templates/500.html b/fatcat_covid19/templates/500.html new file mode 100644 index 0000000..a99232c --- /dev/null +++ b/fatcat_covid19/templates/500.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% block body %} + +
+
500
+
Internal Error
+ +

Hrm, something unexpected went wrong. You may have found a bug! This request +should be logged and reported automatically; you could re-try or contact us for +more info. +

+ +{% endblock %} diff --git a/fatcat_covid19/templates/about_de.html b/fatcat_covid19/templates/about_de.html new file mode 100644 index 0000000..2dd2b5e --- /dev/null +++ b/fatcat_covid19/templates/about_de.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}About{% endblock %} + +{% block body %} + +{# #} + +

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/templates/about_en.html b/fatcat_covid19/templates/about_en.html new file mode 100644 index 0000000..2dd2b5e --- /dev/null +++ b/fatcat_covid19/templates/about_en.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}About{% endblock %} + +{% block body %} + +{# #} + +

+ +TODO + +{% endblock %} diff --git a/fatcat_covid19/templates/base.html b/fatcat_covid19/templates/base.html new file mode 100644 index 0000000..0ca8471 --- /dev/null +++ b/fatcat_covid19/templates/base.html @@ -0,0 +1,106 @@ + + + + + + + + COVID-19 Research Search + + + + {% block extra_head %}{% endblock %} + + + + + +{% block fullmain %} + +
+{% with messages = get_flashed_messages() %} + {% if messages %} +
+ {# Needs more javascript: #} +
Flash Message!
+
    + {% for message in messages %} +
  • {{ message|safe }} + {% endfor %} +
+
+ {% endif %} +{% endwith %} +{% block fullbody %} +
+ {% block body %}Nothing to see here.{% endblock %} +
+{% endblock %} +
+{% endblock %} + + + + + + +{% block postscript %}{% endblock %} + + + diff --git a/fatcat_covid19/templates/entity_macros.html b/fatcat_covid19/templates/entity_macros.html new file mode 100644 index 0000000..9cded8a --- /dev/null +++ b/fatcat_covid19/templates/entity_macros.html @@ -0,0 +1,117 @@ + +{% macro fulltext_search_result_row(paper) -%} +
+

+ + {% if paper.title %} + {{ paper.title[:512] }} + {% if paper.title|length > 512 %}...{% endif %} + {% else %} + [blank] + {% endif %} + +

+ {% if paper.best_pdf_url %} +
+   fulltext +
+ {% endif %} + {# +
{{ ", ".join(paper.contrib_names[:12]) }} + {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} +
+ #} + {% if paper.contrib_names %} +
+ + {{ ", ".join(paper.contrib_names[:12]) }} + {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} + +
+ {% endif %} + {% if paper.release_year %} + {{ paper.release_year }} + {% endif %} + {% if paper.release_type %} + {% if paper.release_type in ("article-journal", "paper-conference") %} + {{ paper.release_type }} + {% elif paper.release_type in ("book") %} + {{ paper.release_type }} + {% else %} + {{ paper.release_type }} + {% endif %} + {% endif %} + {% if paper.withdrawn_status %} + {{ paper.withdrawn_status }} + {% endif %} + {% if paper.release_stage and paper.release_stage != "published" %} + {{ paper.release_stage }} + {% elif not paper.release_stage %} + unknown + {% endif %} + {% if paper.container_name %} + {% if paper.container_id %} + {{ paper.container_name }} + {% else %} + {{ paper.container_name }} + {% endif %} + {% if paper.container_is_oa %}{% endif %} + {% endif %} + {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} +
+ {% endif %} + {% if paper.doi %} + doi:{{ paper.doi }}   + {% endif %} + {% if paper.pmid %} + pmid:{{ paper.pmid }}   + {% endif %} + {% if paper.arxiv_id %} + arXiv:{{ paper.arxiv_id }}   + {% endif %} + {% if False %} {# XXX: elastic release work grouping searches #} +
+ and 5 other versions of the same work! + {% endif %} +
+{% endmacro %} + + +{% macro top_results(found) -%} + +Showing + {% if found.offset == 0 %} + first + {% else %} + results {{ found.offset }} — + {% endif %} + + {{ found.offset + found.count_returned }} + out of {{ found.count_found }} results + + +{%- endmacro %} + + +{% macro bottom_results(found, endpoint='search.fulltext_search') -%} + +{% if found.offset > 0 %} + {% if found.offset - found.limit < 0 %} + « Previous + {% else %} + « Previous + {% endif %} +{% else %} + « Previous +{% endif %} + +  Showing results {{ found.offset }} — {{ found.offset + +found.count_returned }} out of {{ found.count_found }} results   + +{% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %} + Next » + {% else %} + Next » +{% endif %} + +{%- endmacro %} diff --git a/fatcat_covid19/templates/fulltext_search.html b/fatcat_covid19/templates/fulltext_search.html new file mode 100644 index 0000000..dd42f9b --- /dev/null +++ b/fatcat_covid19/templates/fulltext_search.html @@ -0,0 +1,72 @@ +{% import "entity_macros.html" as entity_macros %} +{% extends "base.html" %} + +{% block title %} +{% if query %} + Search: {{ query }} +{% else %} + Fulltext Search +{% endif %} +{% endblock %} + + +{% block fullmain %} + +
+
+

Search all COVID-19 Resources

+
+
+
+ + +
+
+ + +
+
Can also lookup by identifier or search for containers (eg, journals). +
+
+
+
+ +
+
+ +{% if found %} +{% if found.results %} + {{ entity_macros.top_results(found) }} + + {% for paper in found.results %} + {{ entity_macros.fulltext_search_result_row(paper) }} +{% endfor %} +{% if found.results|length > 8 %} +
+
+ {{ entity_macros.bottom_results(found)}} +
+{% endif %} +{% else %} + +Raw query was: {{ found.query.q }} + +
+
+
+ confused paper man +
+
+

No results found!

+

You could try elsewhere:

+ +
+{% endif %} +{% endif %} + +
+{% endblock %} diff --git a/fatcat_covid19/templates/home.html b/fatcat_covid19/templates/home.html new file mode 100644 index 0000000..dbfb833 --- /dev/null +++ b/fatcat_covid19/templates/home.html @@ -0,0 +1,94 @@ +{% extends "base.html" %} + +{# no special title for now #} +{# {% block title %}Perpetual Access to the Scholarly Record{% endblock %} #} + +{% block extra_head %} + +{% endblock %} + +{% block fullmain %} + +
+
+

+ {{ _("Search tens of thousands of COVID-19 research papers and documents") }} +

+
+
+ +
+
+ + +
+
+
+
+
+ +
+
+
+
+
+ {{ _("Project Status") }}: {{ _("Prototype") }} +   + {{ _("These resources are not qualified medical advice!") }} +
+
+
+
+
+ +{# +
+
+
+
+
+ + confused paper man +
+
+

Fatcat is a versioned, user-editable catalog of research + publications including journal articles, conference proceedings, and + datasets +

Features include archival file-level metadata (verified digests and + long-term copies), an + open, documented API, + and work/release indexing (eg, distinguishing between and linking + pre-prints, manuscripts, and version-of-record). +  Read more... +

+
+
+
+
+#} + +
+
+
+
+
+

This service is hosted at The Internet Archive, a US + non-profit dedicated to providing Universal Access to All Knowledge. + {# + Donations welcome! +

Development funding comes from + The Andrew Mellon Foundation + to improve preservation and access to "long-tail" open access works on + the public web which might otherwise be lost. + #} +

+
+ IA logo +
+
+
+
+
+ +{% endblock %} diff --git a/fatcat_covid19/templates/sources.html b/fatcat_covid19/templates/sources.html new file mode 100644 index 0000000..17b0818 --- /dev/null +++ b/fatcat_covid19/templates/sources.html @@ -0,0 +1,119 @@ +{% extends "base.html" %} + +{% block title %}About{% endblock %} + +{% block body %} + +{# #} + +

+ +

Fatcat is versioned, publicly-editable catalog of research publications: +journal articles, conference proceedings, pre-prints, blog posts, and so forth. +The goal is to improve the state of preservation and access to these works by +providing a manifest of full-text content versions and locations. + +

This service does not directly contain full-text content itself, but +provides basic access for human and machine readers through links to copies in +web archives, repositories, and the public web. + +

Significantly more context and background information can be found in The Guide. + +

Feedback and queries can be directed to +webservices@archive.org. + +

Goals and Features

+ +

A few things set Fatcat apart from similar indexing and discovery services: + +

    +
  • inclusion of archival, file-level metadata (hashes) in addition + to URLs, which allows automated verification ("do I have the right copy"), + reveals content-drift over time, and enables efficient distribution of + content through the ecosystem +
  • native support for "post-PDF" digital media, including archival web + captures and datasets, as well as content stored on the distributed web +
  • data model that captures the work/edition distinction, + grouping pre-print, post-review, published, re-published, and updated + versions of a work together +
  • public editing interface, allowing metadata corrections and improvements + from individuals and bots in addition to automated imports from authoritative + sources +
  • focus on providing a stable API and corpus (making integration with + diverse user-facing applications simple), while enabling full replication and + mirroring of the corpus to reduce the risks of centralized control +
+ +

This service aspires to be a piece of sustainable, long-term, non-profit, +free-software, collaborative, open digital infrastructure. It is primarily +designed to support the archival and dissemination roles of +scholarly communication. It may also support the registration role +(establishing precedence and authorship), but explicitly does not aid with +certification of content, and is not intended to be used for +evaluation of individuals, institutions, or venues. This service is +"universal", not currated, and happily includes retracted and "predatory" +content). + +

Sources of Metadata

+ +The source of all bibliographic information is recorded in edit history +metadata, which allows the provenance of all records to be reconstructed. A few +major sources are worth highlighting here: + +
    +
  • Release metadata from Crossref, via their public + REST API +
  • Release metadata and linked full-text content from NIH Pubmed and arXiv.org +
  • Release metadata and linked public domain full-text content the JSTOR Early Journal Content collection +
  • Creator names and de-duplication from ORCID, via their annual public data releases +
  • Journal title metadata from DOAJ, ISSN ROAD, and SHERPA/RoMEO +
  • Full-text URL lists from CORE, + Unpaywall, + Semantic Scholar, + CiteseerX, + and Microsoft Academic Graph. +
  • The Guide lists more major sources +
+ +Many thanks for the hard work of all these projects, institutions, and +individuals! + + +

Support and Acknowledgments

+ +

Fatcat is a project of the Internet Archive, +a US-based non-profit digital library, well known for its +Wayback Machine web archive and +Open Library book digitization and +lending service. All Fatcat databases and services run on Internet Archive +servers in California, and a copy of most full-text content is stored in the +Archive's collections and/or web archives. + +

Development of Fatcat and related web harvesting, indexing, and preservation +efforts at the Archive have been partially funded (for the 2018-2019 period) by +a generous grant from the Mellon Foundation +("Long-tail Open Access Journal Preservation"). +Fatcat supports this work by both tracking which open access works in known +archives and providing minimum-viable indexing and access mechanisms for +long-tail works which otherwise would lack them. + +

The service would not technically be possible without hundreds of Free +Software components and the efforts of their individual and organizational +maintainers, more than can be listed here (please see the source code for full +lists). A few major components include the PostgreSQL database, Elasticsearch +search engine, Flask python web framework, Rust programming language, Diesel +database library, Swagger/OpenAPI code generators, Kafka distributed log, +Ansible configuration management tool, and Ubuntu GNU/Linux operating system +distribution. + +

The front-page photo of a large feline with a cup of coffee is by +Quinn Kampschroer, +under a CC-0 license. The name "Fatcat" can be interpreted as short for "large +catalog", as the service aspires to be a complete catalog of the digital +scholarly record. + +

A list of technical contributors, including volunteers, is maintained in the +source code repository (CONTRIBUTORS.md). Thanks everybody! + +{% endblock %} -- cgit v1.2.3