make integrity checks accassible from cli
All checks were successful
Mypy / mypy (push) Successful in 1m15s
Pytest / pytest (3.12) (push) Successful in 1m19s
Pytest / pytest (3.13) (push) Successful in 1m12s
Pytest / pytest (3.14) (push) Successful in 1m17s
Ruff / ruff (push) Successful in 1m0s
Mypy / mypy (pull_request) Successful in 1m13s
Pytest / pytest (3.12) (pull_request) Successful in 1m19s
Pytest / pytest (3.13) (pull_request) Successful in 1m11s
Pytest / pytest (3.14) (pull_request) Successful in 1m14s
Ruff / ruff (pull_request) Successful in 1m4s
All checks were successful
Mypy / mypy (push) Successful in 1m15s
Pytest / pytest (3.12) (push) Successful in 1m19s
Pytest / pytest (3.13) (push) Successful in 1m12s
Pytest / pytest (3.14) (push) Successful in 1m17s
Ruff / ruff (push) Successful in 1m0s
Mypy / mypy (pull_request) Successful in 1m13s
Pytest / pytest (3.12) (pull_request) Successful in 1m19s
Pytest / pytest (3.13) (pull_request) Successful in 1m11s
Pytest / pytest (3.14) (pull_request) Successful in 1m14s
Ruff / ruff (pull_request) Successful in 1m4s
This commit is contained in:
parent
199e9579db
commit
23b5d066f7
2 changed files with 8 additions and 13 deletions
|
|
@ -9,7 +9,7 @@ from .tools import str2list
|
||||||
from .main import update_aliases
|
from .main import update_aliases
|
||||||
from .meas_io import drop_cache as mio_drop_cache
|
from .meas_io import drop_cache as mio_drop_cache
|
||||||
from .meas_io import load_record as mio_load_record
|
from .meas_io import load_record as mio_load_record
|
||||||
# from .integrity import
|
from .integrity import full_integrity_check
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pyerrors import Corr
|
from pyerrors import Corr
|
||||||
|
|
@ -146,15 +146,8 @@ def check(path: Path = typer.Option(
|
||||||
"--dataset",
|
"--dataset",
|
||||||
"-d",
|
"-d",
|
||||||
),
|
),
|
||||||
files: str = typer.Argument(
|
) -> None:
|
||||||
),
|
full_integrity_check(path)
|
||||||
copy_file: bool = typer.Option(
|
|
||||||
bool(True),
|
|
||||||
"--save",
|
|
||||||
"-s",
|
|
||||||
),) -> None:
|
|
||||||
|
|
||||||
"✅" : "❌"
|
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,21 @@ def are_keys_unique(db: Path, table: str, col: str) -> bool:
|
||||||
def check_db_integrity(path: Path) -> None:
|
def check_db_integrity(path: Path) -> None:
|
||||||
db = get_db_file(path)
|
db = get_db_file(path)
|
||||||
|
|
||||||
if not are_keys_unique(db, 'backlogs', 'path'):
|
if not are_keys_unique(path / db, 'backlogs', 'path'):
|
||||||
raise Exception("The paths the backlog table of the database links are not unique.")
|
raise Exception("The paths the backlog table of the database links are not unique.")
|
||||||
|
|
||||||
search_expr = "SELECT * FROM 'backlogs'"
|
search_expr = "SELECT * FROM 'backlogs'"
|
||||||
conn = sqlite3.connect(db)
|
conn = sqlite3.connect(path / db)
|
||||||
results = pd.read_sql(search_expr, conn)
|
results = pd.read_sql(search_expr, conn)
|
||||||
|
|
||||||
for _, result in results.iterrows():
|
for _, result in results.iterrows():
|
||||||
if not has_valid_times(result):
|
if not has_valid_times(result):
|
||||||
raise ValueError(f"Result with id {result[id]} has wrong time signatures.")
|
raise ValueError(f"Result with id {result[id]} has wrong time signatures.")
|
||||||
|
print("DB:\t✅")
|
||||||
|
|
||||||
|
|
||||||
def full_integrity_check(path: Path) -> None:
|
def full_integrity_check(path: Path) -> None:
|
||||||
check_db_integrity(path)
|
check_db_integrity(path)
|
||||||
|
print("Full:\t✅")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue