mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 05:55:42 +09:00
81 lines
2.9 KiB
Julia
81 lines
2.9 KiB
Julia
module PSBoardDataBase
|
|
|
|
using SQLite
|
|
using DBInterface
|
|
using Tables
|
|
using CSV
|
|
using DataFrames
|
|
using Dates
|
|
|
|
include("parse_qaqc_master_log.jl")
|
|
include("parse_clock.jl")
|
|
|
|
include("create_table.jl")
|
|
include("download_csv.jl")
|
|
include("import_data.jl")
|
|
|
|
include("dispatch_checker.jl")
|
|
using .DispatchChecker
|
|
|
|
"""
|
|
create_database_from_exported_csvs(
|
|
dbpath::AbstractString;
|
|
single_run_csv::AbstractString = DownloadCSVs.download_single_run_csv(),
|
|
runlist_csv::AbstractString = DownloadCSVs.download_runlist_csv(),
|
|
dispatch_csv::AbstractString = DownloadCSVs.download_dispatch_csv(),
|
|
hundred_csv::AbstractString = DownloadCSVs.download_hundred_run_csv(),
|
|
jathubs_csv::AbstractString = DownloadCSVs.download_jathub_csv(),
|
|
masterlog_dir::AbstractString,
|
|
slavelog_dir::AbstractString,
|
|
)
|
|
|
|
Create database at `dbpath` and import data from CSV and master log files.
|
|
|
|
# Arguments
|
|
|
|
## Required
|
|
- `dbpath`: where the database will be created
|
|
- `masterlog_dir`: path to the directory (`log`) where all JATHub master logs are stored
|
|
- `slavelog_dir`: path to the directory where all JATHub slave logs are stored
|
|
|
|
## Optional
|
|
- `single_run_csv`: CSV of single run results exported from the Google sheets database
|
|
- `runlist_csv`: CSV of run lists exported from the Google sheets database
|
|
- `dispatch_csv`: CSV of dispatch lists exported from the Google sheets database
|
|
- `hundred_csv`: CSV of 100 tests results exported from the Google sheets database
|
|
- `jathubs_csv`: CSV for jathub list used in QAQC. Used to add skew.
|
|
"""
|
|
function create_database_from_exported_csvs(
|
|
dbpath::AbstractString;
|
|
single_run_csv::AbstractString = DownloadCSVs.download_single_run_csv(),
|
|
runlist_csv::AbstractString = DownloadCSVs.download_runlist_csv(),
|
|
dispatch_csv::AbstractString = DownloadCSVs.download_dispatch_csv(),
|
|
hundred_csv::AbstractString = DownloadCSVs.download_hundred_run_csv(),
|
|
jathubs_csv::AbstractString = DownloadCSVs.download_jathub_csv(),
|
|
masterlog_dir::AbstractString,
|
|
slavelog_dir::AbstractString,
|
|
)
|
|
db = create_database(dbpath)
|
|
single_result_df = CSV.read(single_run_csv, DataFrame)
|
|
runlist_table = CSV.read(runlist_csv, DataFrame)
|
|
dispatch_table = CSV.read(dispatch_csv, DataFrame)
|
|
extra_100test_result_df = CSV.read(hundred_csv, DataFrame)
|
|
jathubs_table = CSV.read(jathubs_csv, DataFrame)
|
|
|
|
insert_qaqc_campaign_id(db)
|
|
insert_qaqc_positions(db, jathubs_table)
|
|
|
|
add_psboard_ids(db, single_result_df)
|
|
add_qaqc_runlist_from_runlist(db, runlist_table)
|
|
add_qaqc_single_result(db, single_result_df, runlist_table)
|
|
add_qaqc_dispatch(db, dispatch_table)
|
|
add_qaqc_runlist_from_masterlogs(db, masterlog_dir)
|
|
add_qaqc_100test_result(db, extra_100test_result_df)
|
|
add_skew_from_slave_clk_logs(db, slavelog_dir)
|
|
|
|
db
|
|
end
|
|
|
|
greet() = print("Hello World!")
|
|
|
|
end # module PSBoardDataBase
|