Skip to content

Commit 3accaa9

Browse files
authored
Merge pull request #50 from NeotomaDB/data-review-tool-testing
Data review tool tests
2 parents 38b4f66 + c8c89f9 commit 3accaa9

5 files changed

Lines changed: 182 additions & 109 deletions

File tree

docker/data-review-tool/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ COPY ./docker/data-review-tool/requirements.txt .
77
# Install the Python dependencies
88
RUN pip install --no-cache-dir -r requirements.txt
99

10-
RUN git clone https://github.com/NeotomaDB/MetaExtractor
11-
1210
WORKDIR MetaExtractor/
11+
# Copy the entire repository folder into the container
12+
COPY src ./src
1313

14-
RUN git switch dev
14+
# RUN git clone https://github.com/NeotomaDB/MetaExtractor
15+
# WORKDIR MetaExtractor/
16+
# RUN git switch dev
1517

1618
# Expose the port your Dash app is running on
1719
EXPOSE 8050

src/data_review_tool/app.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import dash
32
from dash import dcc, html
43
import dash_bootstrap_components as dbc
@@ -7,29 +6,31 @@
76
from pages.navbar import create_navbar
87

98

10-
app = dash.Dash(__name__,
11-
use_pages=True,
12-
external_stylesheets=[dbc.themes.BOOTSTRAP, "src/data_review_tool/assets/styles.css"],
13-
title="Finding Fossils",
14-
suppress_callback_exceptions=True,)
9+
app = dash.Dash(
10+
__name__,
11+
use_pages=True,
12+
external_stylesheets=[
13+
dbc.themes.BOOTSTRAP,
14+
"src/data_review_tool/assets/styles.css",
15+
],
16+
title="Finding Fossils",
17+
suppress_callback_exceptions=True,
18+
)
1519

1620
server = app.server
1721

1822
navbar = create_navbar()
1923

2024

2125
app.layout = html.Div(
22-
children=
23-
[
24-
navbar,
25-
dash.page_container
26-
],
26+
children=[navbar, dash.page_container],
2727
style={
2828
"width": "100%",
2929
"height": "100%",
30-
"overflow": "hidden",}
31-
)
30+
"overflow": "hidden",
31+
},
32+
)
3233
app._favicon = "finding-fossils.ico"
3334

3435
if __name__ == "__main__":
35-
app.run_server("0.0.0.0", debug=True)
36+
app.run_server("0.0.0.0", debug=True, port=8050)

src/data_review_tool/pages/article_review.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def layout(gddid=None):
3030
# get the metadata of the article
3131
if os.path.exists(os.path.join("data",
3232
"data-review-tool",
33-
"completed",
33+
"processed",
3434
f"{gddid}.json")):
3535
article = open(os.path.join("data",
3636
"data-review-tool",
37-
"completed",
37+
"processed",
3838
f"{gddid}.json"), "r")
3939
else:
4040
article = open(os.path.join("data",
@@ -499,7 +499,7 @@ def cell_clicked(n_clicks):
499499
str: The href of the home button
500500
"""
501501
if n_clicks:
502-
return f"http://0.0.0.0:8050/"
502+
return f"/"
503503
else:
504504
return dash.no_update
505505

@@ -843,7 +843,10 @@ def save_submit(submit, save, relevant, data):
843843
results["last_updated"] = datetime.now().strftime("%Y-%m-%d")
844844
gddid = results["gddid"]
845845
data = json.dumps(results)
846-
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
846+
with open(os.path.join("data",
847+
"data-review-tool",
848+
"processed",
849+
f"{gddid}.json"), "w") as f:
847850
f.write(data)
848851
return dmc.Notification(
849852
title="Review Complete!",
@@ -858,7 +861,10 @@ def save_submit(submit, save, relevant, data):
858861
results["last_updated"] = datetime.now().strftime("%Y-%m-%d")
859862
gddid = results["gddid"]
860863
data = json.dumps(results)
861-
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
864+
with open(os.path.join("data",
865+
"data-review-tool",
866+
"processed",
867+
f"{gddid}.json"), "w") as f:
862868
f.write(data)
863869
return dmc.Notification(
864870
title="Article Removed!",
@@ -872,7 +878,10 @@ def save_submit(submit, save, relevant, data):
872878
results["status"] = "In Progress"
873879
gddid = results["gddid"]
874880
data = json.dumps(results)
875-
with open(f"data/data-review-tool/completed/{gddid}.json", "w") as f:
881+
with open(os.path.join("data",
882+
"data-review-tool",
883+
"processed",
884+
f"{gddid}.json"), "r") as f:
876885
f.write(data)
877886
return dmc.Notification(
878887
title="Progress Saved!",

0 commit comments

Comments
 (0)