Compare commits

...

8 Commits

Author SHA1 Message Date
Alan Orth 2fcfc76ea5
csv_metadata_quality_web/main.py: Remove check for __main__
continuous-integration/drone/push Build is passing Details
This is only needed if we are running directly in Python.
2021-03-14 22:05:04 +02:00
Alan Orth 78f58b459c
Create application for gunicorn
This is apparently what gunicorn looks for.
2021-03-14 22:03:15 +02:00
Alan Orth 863a540225
Move csv_metadata_quality_web to a package
Eventually I will want to refactor so this will be necessary.
2021-03-14 22:01:45 +02:00
Alan Orth cc203b2842
Regenerate requirements
Generated using poetry:

  $ poetry export --without-hashes -f requirements.txt > requirements.txt
  $ poetry export --without-hashes --dev -f requirements.txt > requirements-dev.txt
2021-03-14 21:10:33 +02:00
Alan Orth de0703ceb2
poetry.lock: Run poetry update 2021-03-14 21:09:58 +02:00
Alan Orth 2a852c9ed3
pyproject.toml: Pin new version of csv-metadata-quality
This version doesn't bother checking invalid multi-value separators.
Instead it just fixes them.
2021-03-14 21:09:07 +02:00
Alan Orth edd651317b
templates/index.html: Change default selections
Enable AGROVOC lookup on dcterms.subject as well as the "unsafe"
fixes. For the AGROVOC lookup I just think that it  might not be
obvious to non-technical users that you have to check the box AND
enter a field name, despite the placeholder value. In any case, it
doesn't hurt to enable AGROVOC lookup by default because it won't
fail if the default dcterms.subject field is not present in the
user's CSV.
2021-03-14 20:54:50 +02:00
Alan Orth 6f396f392f Revert "Move style.min.css to css/v1/style.min.css"
This reverts commit 8f6d337d2d.

We are using Heroku now so we don't need this phony version.
2021-03-14 20:40:33 +02:00
14 changed files with 18 additions and 22 deletions

View File

@ -1 +1 @@
web: gunicorn main:app --log-file -
web: gunicorn csv_metadata_quality_web.main --log-file -

View File

View File

@ -15,7 +15,7 @@ from flask import (
)
from werkzeug.utils import secure_filename
app = Flask(__name__)
app = application = Flask(__name__)
app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024
app.config["UPLOAD_EXTENSIONS"] = [".csv"]
# the only place we can write to on Google App Engine is /tmp
@ -127,7 +127,3 @@ def result_download(base64slug):
filename = secure_filename(os.path.splitext(filename)[0] + "-cleaned.csv")
return send_from_directory(app.config["UPLOAD_PATH"], filename, as_attachment=True)
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8080, debug=True)

View File

@ -4,5 +4,5 @@
<meta name="description" content="Simple web interface for the DSpace CSV Metadata Quality tool.">
<meta name="author" content="Alan Orth">
<title>DSpace CSV Metadata Quality Checker</title>
<link href="{{ url_for('static', filename='css/v1/style.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/style.min.css') }}" rel="stylesheet">
</head>

View File

@ -24,14 +24,14 @@
<div class="input-group mb-3">
<div class="input-group-text">
Validate field(s) against AGROVOC&nbsp;
<input class="form-check-input" type="checkbox" id="agrovocFieldsCheckbox" name="agrovocCheckbox" aria-label="Checkbox for following text input">
<input class="form-check-input" type="checkbox" checked="true" id="agrovocFieldsCheckbox" name="agrovocCheckbox" aria-label="Checkbox for following text input">
</div>
<input type="text" class="form-control" placeholder="dcterms.subject" id="agrovocFieldsText" name="agrovocText" aria-label="Text input with checkbox">
<input type="text" class="form-control" value="dcterms.subject" id="agrovocFieldsText" name="agrovocText" aria-label="Text input with checkbox">
<div id="agrovocHelp" class="form-text">Optionally indicate fields to validate against <a href="https://agrovoc.uniroma2.it/agrovoc/agrovoc/en/" title="AGROVOC Multilingual Thesaurus">AGROVOC</a>. Separate multiple fields with a comma, for example: <code>dcterms.subject,cg.coverage.country</code>. Note: this can take an extra minute or more depending on your data. If you have a problem please try again and it will generally be faster the second time.</div>
</div>
<div class="mb-3 form-check form-switch">
<input class="form-check-input" type="checkbox" id="unsafeCheckbox" name="unsafe">
<input class="form-check-input" type="checkbox" checked="true" id="unsafeCheckbox" name="unsafe">
<label class="form-check-label" for="unsafeCheckbox" aria-describedby="unsafeHelp">Enable unsafe fixes</label>
<div id="unsafeHelp" class="form-text">This will remove newlines and perform <a href="https://withblue.ink/2019/03/11/why-you-need-to-normalize-unicode-strings.html" title='When "Zoë" !== "Zoë". Or why you need to normalize Unicode strings'>normalization of Unicode characters</a>. Read more about these <a href="https://github.com/ilri/csv-metadata-quality#unsafe-fixes">unsafe fixes</a>.</div>
</div>

View File

@ -10,8 +10,8 @@
"sass": "^1.32.7"
},
"scripts": {
"build:css": "sass --style expanded source/scss/style.scss static/css/v1/style.css.tmp && cleancss --level 1 static/css/v1/style.css.tmp -o static/css/v1/style.min.css",
"build:css": "sass --style expanded source/scss/style.scss static/css/style.css.tmp && cleancss --level 1 static/css/style.css.tmp -o static/css/style.min.css",
"build": "npm run build:css && npm run clean",
"clean": "rm static/css/v1/style.css.tmp static/css/v1/style.css.tmp.map"
"clean": "rm static/css/style.css.tmp static/css/style.css.tmp.map"
}
}

12
poetry.lock generated
View File

@ -107,8 +107,8 @@ xlrd = "^1.2.0"
[package.source]
type = "git"
url = "https://github.com/ilri/csv-metadata-quality.git"
reference = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"
resolved_reference = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"
reference = "10612cf8911f289f140f51fa7186ae4eed4e602f"
resolved_reference = "10612cf8911f289f140f51fa7186ae4eed4e602f"
[[package]]
name = "decorator"
@ -175,7 +175,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "importlib-metadata"
version = "3.7.2"
version = "3.7.3"
description = "Read metadata from Python packages"
category = "dev"
optional = false
@ -606,7 +606,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
[metadata]
lock-version = "1.1"
python-versions = "^3.7.1"
content-hash = "d1dabfe5cad9e7218ce3f5b45ce39b4823d2262aca7228045af5e5ae6654c7aa"
content-hash = "179deeadc57404afabd0792cd5e6963d7b3aaf4b3f6a6b4500feb3f4862100c9"
[metadata.files]
ansi2html = [
@ -666,8 +666,8 @@ idna = [
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
]
importlib-metadata = [
{file = "importlib_metadata-3.7.2-py3-none-any.whl", hash = "sha256:407d13f55dc6f2a844e62325d18ad7019a436c4bfcaee34cda35f2be6e7c3e34"},
{file = "importlib_metadata-3.7.2.tar.gz", hash = "sha256:18d5ff601069f98d5d605b6a4b50c18a34811d655c55548adc833e687289acde"},
{file = "importlib_metadata-3.7.3-py3-none-any.whl", hash = "sha256:b74159469b464a99cb8cc3e21973e4d96e05d3024d337313fedb618a6e86e6f4"},
{file = "importlib_metadata-3.7.3.tar.gz", hash = "sha256:742add720a20d0467df2f444ae41704000f50e1234f46174b51f9c6031a1bd71"},
]
ipython = [
{file = "ipython-7.21.0-py3-none-any.whl", hash = "sha256:34207ffb2f653bced2bc8e3756c1db86e7d93e44ed049daae9814fed66d408ec"},

View File

@ -7,7 +7,7 @@ license = "AGPL-3.0-only"
[tool.poetry.dependencies]
python = "^3.7.1"
csv-metadata-quality = {git = "https://github.com/ilri/csv-metadata-quality.git", rev = "0e9176f0a6f694e85d38bf15c6b80708402bfa8b"}
csv-metadata-quality = {git = "https://github.com/ilri/csv-metadata-quality.git", rev = "10612cf8911f289f140f51fa7186ae4eed4e602f"}
Flask = "^1.1.2"
ansi2html = "^1.6.0"
gunicorn = "^20.0.4"

View File

@ -7,13 +7,13 @@ certifi==2020.12.5; python_full_version >= "3.7.1" and python_full_version < "4.
chardet==4.0.0; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
click==7.1.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
colorama==0.4.4; python_full_version >= "3.7.1" and python_full_version < "4.0.0" and (python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0")
csv-metadata-quality @ git+https://github.com/ilri/csv-metadata-quality.git@0e9176f0a6f694e85d38bf15c6b80708402bfa8b ; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
csv-metadata-quality @ git+https://github.com/ilri/csv-metadata-quality.git@10612cf8911f289f140f51fa7186ae4eed4e602f ; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
decorator==4.4.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.7"
flake8==3.8.4; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
flask==1.1.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
gunicorn==20.0.4; python_version >= "3.4"
idna==2.10; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
importlib-metadata==3.7.2; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.4.0" and python_version < "3.8" and python_version >= "3.6"
importlib-metadata==3.7.3; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.4.0" and python_version < "3.8" and python_version >= "3.6"
ipython-genutils==0.2.0; python_version >= "3.7"
ipython==7.21.0; python_version >= "3.7"
isort==5.7.0; python_version >= "3.6" and python_version < "4.0"

View File

@ -3,7 +3,7 @@ certifi==2020.12.5; python_full_version >= "3.7.1" and python_full_version < "4.
chardet==4.0.0; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
click==7.1.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
colorama==0.4.4; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
csv-metadata-quality @ git+https://github.com/ilri/csv-metadata-quality.git@0e9176f0a6f694e85d38bf15c6b80708402bfa8b ; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
csv-metadata-quality @ git+https://github.com/ilri/csv-metadata-quality.git@10612cf8911f289f140f51fa7186ae4eed4e602f ; python_full_version >= "3.7.1" and python_full_version < "4.0.0"
flask==1.1.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
gunicorn==20.0.4; python_version >= "3.4"
idna==2.10; python_full_version >= "3.7.1" and python_full_version < "4.0.0"