Skip to content

Commit

Permalink
Gh pages
Browse files Browse the repository at this point in the history
# Conflicts:
#	scripts/main.py
  • Loading branch information
corneliusroemer committed Aug 12, 2024
1 parent 1ffcc82 commit 6a05b0b
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
63 changes: 63 additions & 0 deletions scripts/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# %%
import datetime
import os
import xml.etree.ElementTree as ET

Expand Down Expand Up @@ -55,3 +56,65 @@ def get_file_url(url: str) -> str:

with open(filepath, "wb") as file:
file.write(response.content)

#%%
# Separate the English and German file URLs based on the filename
english_file_urls = [url for url in file_urls if "_EN_" in os.path.basename(url)]
german_file_urls = [url for url in file_urls if "_EN_" not in os.path.basename(url)]

# Create a simple index.html file with links to the downloaded PDFs
with open("index.html", "w") as file:
file.write("""
<html>
<head>
<style>
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 20px; color: #333; line-height: 1.6; }
h1 { color: #2c3e50; font-size: 24px; }
h2 { color: #2c3e50; font-size: 20px; }
p { font-size: 16px; }
a { text-decoration: none; color: #3498db; }
a:hover { color: #2980b9; }
.report-section { margin-bottom: 40px; }
.report-list { margin-left: 20px; }
.container { max-width: 800px; margin: auto; }
</style>
<title>RKI Abwasser Reports Mirror</title>
</head>
<body>
<div class="container">
<h1>RKI Abwasser Reports Mirror</h1>
<p>This website serves as a mirror for the Robert Koch Institute (RKI) wastewater reports, allowing direct access to the latest reports without requiring file downloads. You can browse the available English and German reports below.</p>
<p>The original reports are available at <a href="https://edoc.rki.de/handle/176904/11665">https://edoc.rki.de/handle/176904/11665</a>.</p>
<div class="report-section">
<h2>English Reports</h2>
<div class="report-list">
""")

for url in english_file_urls:
filename = os.path.basename(url)
file.write(f'<a href="data/{filename}">{filename}</a><br>')

file.write("""
</div>
</div>
<div class="report-section">
<h2>German Reports</h2>
<div class="report-list">
""")

for url in german_file_urls:
filename = os.path.basename(url)
file.write(f'<a href="data/{filename}">{filename}</a><br>')

file.write(f"""
</div>
</div>
<p>Created by <a href="https://github.com/corneliusroemer">Cornelius Roemer</a><br>
Source code available on <a href="https://github.com/corneliusroemer/rki-abwasser-reports">GitHub</a><br>
Last updated: {datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%S %Z")}</p>
</div>
</body>
</html>
""")
# %%
90 changes: 90 additions & 0 deletions scripts/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 88
indent-width = 4

# Assume Python 3.8
target-version = "py312"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
]
ignore = ["E501"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

0 comments on commit 6a05b0b

Please sign in to comment.