Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docker/data-review-tool/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ COPY ./docker/data-review-tool/requirements.txt .
# Install the Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

RUN git clone https://github.com/NeotomaDB/MetaExtractor

WORKDIR MetaExtractor/
# Copy the entire repository folder into the container
COPY src ./src

RUN git switch dev
# RUN git clone https://github.com/NeotomaDB/MetaExtractor
# WORKDIR MetaExtractor/
# RUN git switch dev

# Expose the port your Dash app is running on
EXPOSE 8050
Expand Down
29 changes: 15 additions & 14 deletions src/data_review_tool/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import dash
from dash import dcc, html
import dash_bootstrap_components as dbc
Expand All @@ -7,29 +6,31 @@
from pages.navbar import create_navbar


app = dash.Dash(__name__,
use_pages=True,
external_stylesheets=[dbc.themes.BOOTSTRAP, "src/data_review_tool/assets/styles.css"],
title="Finding Fossils",
suppress_callback_exceptions=True,)
app = dash.Dash(
__name__,
use_pages=True,
external_stylesheets=[
dbc.themes.BOOTSTRAP,
"src/data_review_tool/assets/styles.css",
],
title="Finding Fossils",
suppress_callback_exceptions=True,
)

server = app.server

navbar = create_navbar()


app.layout = html.Div(
children=
[
navbar,
dash.page_container
],
children=[navbar, dash.page_container],
style={
"width": "100%",
"height": "100%",
"overflow": "hidden",}
)
"overflow": "hidden",
},
)
app._favicon = "finding-fossils.ico"

if __name__ == "__main__":
app.run_server("0.0.0.0", debug=True)
app.run_server("0.0.0.0", debug=True, port=8050)
21 changes: 15 additions & 6 deletions src/data_review_tool/pages/article_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def layout(gddid=None):
# get the metadata of the article
if os.path.exists(os.path.join("data",
"data-review-tool",
"completed",
"processed",
f"{gddid}.json")):
article = open(os.path.join("data",
"data-review-tool",
"completed",
"processed",
f"{gddid}.json"), "r")
else:
article = open(os.path.join("data",
Expand Down Expand Up @@ -499,7 +499,7 @@ def cell_clicked(n_clicks):
str: The href of the home button
"""
if n_clicks:
return f"http://0.0.0.0:8050/"
return f"/"
else:
return dash.no_update

Expand Down Expand Up @@ -843,7 +843,10 @@ def save_submit(submit, save, relevant, data):
results["last_updated"] = datetime.now().strftime("%Y-%m-%d")
gddid = results["gddid"]
data = json.dumps(results)
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
with open(os.path.join("data",
"data-review-tool",
"processed",
f"{gddid}.json"), "w") as f:
f.write(data)
return dmc.Notification(
title="Review Complete!",
Expand All @@ -858,7 +861,10 @@ def save_submit(submit, save, relevant, data):
results["last_updated"] = datetime.now().strftime("%Y-%m-%d")
gddid = results["gddid"]
data = json.dumps(results)
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
with open(os.path.join("data",
"data-review-tool",
"processed",
f"{gddid}.json"), "w") as f:
f.write(data)
return dmc.Notification(
title="Article Removed!",
Expand All @@ -872,7 +878,10 @@ def save_submit(submit, save, relevant, data):
results["status"] = "In Progress"
gddid = results["gddid"]
data = json.dumps(results)
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
with open(os.path.join("data",
"data-review-tool",
"processed",
f"{gddid}.json"), "r") as f:
f.write(data)
return dmc.Notification(
title="Progress Saved!",
Expand Down
Loading