Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle public and private CSVs #218

Merged
merged 29 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
afc07fc
handle public and private CSV in CLI... but nothing downstream
mccalluc Jan 13, 2025
f4ec7a3
coverage
mccalluc Jan 13, 2025
492c4d6
More readable CLI help
mccalluc Jan 13, 2025
5858129
fake data into separate function
mccalluc Jan 13, 2025
2b95650
warn -> error
mccalluc Jan 13, 2025
25083dd
warn -> error
mccalluc Jan 13, 2025
c76ac79
add private and public component params
mccalluc Jan 13, 2025
9a2ecc3
add explanation in UI
mccalluc Jan 13, 2025
7f6cc46
add cards to organize first tab
mccalluc Jan 13, 2025
b900e05
stub where the warning message will go
mccalluc Jan 14, 2025
c398c9a
warning message about column mismatch
mccalluc Jan 14, 2025
64c01a3
better formating on list
mccalluc Jan 14, 2025
327395d
linting
mccalluc Jan 14, 2025
9c2439d
make the "Define analysis" button conditional
mccalluc Jan 14, 2025
3a0de4e
fix label in end-to-end
mccalluc Jan 14, 2025
c280b0b
reformat for readability
mccalluc Jan 14, 2025
43ef859
match -> mismatch
mccalluc Jan 14, 2025
5bbcc91
read either public or private
mccalluc Jan 14, 2025
9712374
move out content of simulation card
mccalluc Jan 14, 2025
0893d72
Different simulation card if public CSV
mccalluc Jan 14, 2025
630d5a6
fix renaming bugs
mccalluc Jan 14, 2025
cb394fb
add test to fix coverage; use "Optional"
mccalluc Jan 14, 2025
3f4b11b
factor mock data generation out of make_accuracy_histogram
mccalluc Jan 14, 2025
2cbc826
public and private previews
mccalluc Jan 14, 2025
38160f5
start testing conditional display for public vs private
mccalluc Jan 15, 2025
48c1239
nb reads public or private
mccalluc Jan 15, 2025
6f25df7
also make plot title conditional
mccalluc Jan 15, 2025
a4ca970
factor out shared descriptions
mccalluc Jan 15, 2025
df1a17d
missing f on f-string
mccalluc Jan 15, 2025
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
Prev Previous commit
Next Next commit
add test to fix coverage; use "Optional"
mccalluc committed Jan 14, 2025
commit cb394fbd6b1d27cfca16c99bccff5a396a4532da
3 changes: 2 additions & 1 deletion dp_wizard/app/dataset_panel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
from typing import Optional

from shiny import ui, reactive, render, Inputs, Outputs, Session

@@ -102,7 +103,7 @@ def _on_private_csv_path_change():
private_csv_path.set(input.private_csv_path()[0]["datapath"])

@reactive.calc
def csv_column_mismatch_calc() -> tuple[set, set] | None:
def csv_column_mismatch_calc() -> Optional[tuple[set, set]]:
public = public_csv_path()
private = private_csv_path()
if public and private:
8 changes: 8 additions & 0 deletions tests/utils/test_csv_helper.py
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
read_csv_ids_labels,
read_csv_ids_names,
get_csv_names_mismatch,
get_csv_row_count,
)


@@ -24,6 +25,13 @@ def test_get_csv_names_mismatch():
assert just_b == {"d"}


def test_get_csv_row_count():
with tempfile.TemporaryDirectory() as tmp:
path = Path(tmp) / "a.csv"
path.write_text("a,b,c\n1,2,3")
assert get_csv_row_count(path) == 1


# We will not reference the encoding when reading:
# We need to be robust against any input.
@pytest.mark.parametrize("write_encoding", ["latin1", "utf8", "utf-8-sig"])