Coverage for oc_validator / interface / run_gui.py: 0%
13 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-30 15:46 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-30 15:46 +0000
1# ISC License
2#
3# Copyright (c) 2023-2026, Elia Rizzetto, Silvio Peroni
4#
5# Permission to use, copy, modify, and/or distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15# PERFORMANCE OF THIS SOFTWARE.
17from oc_validator.interface.gui import make_gui
18from argparse import ArgumentParser
21if __name__ == '__main__':
23 parser = ArgumentParser(description='Show a visual interface for easily identifying the errors in the validated table.')
24 parser.add_argument('-t', '--table-fp', type=str, required=True, help='Path to the original CSV table containing data.')
25 parser.add_argument('-r', '--report-fp', type=str, required=True, help='Path to the JSON report storing the detailed validation output.')
26 parser.add_argument('-o', '--out-fp', type=str, required=True, help='Path to the output HTML file.')
28 args = parser.parse_args()
30 csv_path = args.table_fp
31 report_path = args.report_fp
32 output_html_path = args.out_fp
34 make_gui(csv_path, report_path, output_html_path)
36"""
37USAGE EXAMPLE
40meta_in = '../data/meta_sample.csv' # META-CSV table filepath
41meta_out_dir = '../results/meta'
42cits_in = '../data/cits_sample.csv' # CITS-CSV table filepath
43cits_out_dir = '../results/cits'
45# Validate both documents, check that there is a transitive closure (the options specified avoid the verification of the existence of external IDs for both documents)
46cv = ClosureValidator(meta_in, meta_out_dir, cits_in, cits_out_dir, meta_kwargs={'verify_id_existence':False}, cits_kwargs={'verify_id_existence':False})
47cv.validate()
49# Create two separate HTML documents for visualising the validation reports of META-CSV and CITS-CSV
50make_gui(meta_in, cv.meta_validator.output_fp_json, '../results/meta_vis.html')
51make_gui(cits_in, cv.cits_validator.output_fp_json, '../results/cits_vis.html')
53# Merge the 2 HTML reports into a single, global one
54merge_html_files('../results/meta_vis.html', '../results/cits_vis.html', '../results/global_vis.html')
55"""