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

Automated Workflow Checks for Data and Models #566

Merged
merged 10 commits into from
Jul 25, 2023
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
55 changes: 55 additions & 0 deletions dev/check_datasets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'''
Automated Checks

Iterate through data catalog via scivision.load_dataset function and log responses

'''

import pandas as pd
from scivision import default_catalog, load_dataset
from tqdm import tqdm
import logging

# Create Logger
logger = logging.getLogger(__name__)
# Set log level
logger.setLevel(logging.INFO)
file_handler = logging.FileHandler('check_datasets.log')
formatter = logging.Formatter('%(asctime)s : %(levelname)s : %(name)s : %(message)s')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)

# Datasource Checks

# Load dataset catalog
datasources_catalog = default_catalog.datasources.to_dataframe()
# Load dataset using load_dataset and record response
rows = []
for index in tqdm(range(datasources_catalog.shape[0])):
name = datasources_catalog.loc[index]['name']
print(f'\nValidating: {name}')
data_url = datasources_catalog.loc[index]['url'][:]
try:
load_dataset(data_url)
check_result = "Pass"
response = None
except Exception as e:
print(e)
logger.exception("Automated Dataset Check has failed!")
check_result = "Fail"
response = logger.error(e, exc_info=True)

new_row = {
'dataset_name': datasources_catalog.loc[index]['name'],
'url': data_url,
'check_result': check_result,
'response': response,
}

rows.append(new_row)

automated_checks_report = pd.DataFrame.from_dict(rows, orient='columns')
automated_checks_report.to_csv('check_datasets.csv', index=False)

automated_checks_report = automated_checks_report.set_index('dataset_name')
automated_checks_report.to_json('check_datasets.json', orient="index")
1 change: 1 addition & 0 deletions frontend/src/catalog_entry_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function CatalogEntryForm({ gh_logged_in, schema, uiSchema, catalog_kind,
branch: user_scivision_fork.default_branch,
});
}

//
///////////

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pydantic~=1.9
exifread~=3.0
distinctipy~=1.2
ipython~=8.3
tqdm~=4.65