mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 14:05:40 +09:00
65 lines
1.9 KiB
Julia
65 lines
1.9 KiB
Julia
module PSBoardDataBase
|
|
|
|
using SQLite
|
|
using DBInterface
|
|
using Tables
|
|
using CSV
|
|
using DataFrames
|
|
using Dates
|
|
|
|
include("parse_qaqc_master_log.jl")
|
|
|
|
include("create_table.jl")
|
|
|
|
include("import_data.jl")
|
|
|
|
"""
|
|
create_database_from_exported_csvs(
|
|
dbpath::AbstractString;
|
|
single_run_csv::AbstractString,
|
|
runlist_csv::AbstractString,
|
|
dispatch_csv::AbstractString,
|
|
hundred_csv::AbstractString,
|
|
masterlog_dir::AbstractString,
|
|
)
|
|
|
|
Create database at `dbpath` and import data from CSV and master log files.
|
|
|
|
# Arguments
|
|
- `dbpath`: where the database will be created
|
|
- `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
|
|
- `masterlog_dir`: path to the directory (`log`) where all JATHub master log is stored
|
|
"""
|
|
function create_database_from_exported_csvs(
|
|
dbpath::AbstractString;
|
|
single_run_csv::AbstractString,
|
|
runlist_csv::AbstractString,
|
|
dispatch_csv::AbstractString,
|
|
hundred_csv::AbstractString,
|
|
masterlog_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)
|
|
|
|
insert_qaqc_campaign_id(db)
|
|
insert_qaqc_positions(db)
|
|
|
|
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)
|
|
|
|
db
|
|
end
|
|
|
|
greet() = print("Hello World!")
|
|
|
|
end # module PSBoardDataBase
|