mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 05:55:42 +09:00
add: database view for single/extra results
This commit is contained in:
parent
21f38e83db
commit
4eafc8bdc6
2 changed files with 86 additions and 14 deletions
|
@ -362,11 +362,19 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
stmt_search_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
SELECT id
|
||||
SELECT id, run_datetime
|
||||
FROM qaqc_runs
|
||||
WHERE id = :runid
|
||||
""",
|
||||
)
|
||||
stmt_update_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
UPDATE qaqc_runs
|
||||
SET run_datetime = :run_datetime, shifter = :shifter, logfile = :logfile, shiftscript_ver = :shiftscript_ver
|
||||
WHERE id = :runid
|
||||
""",
|
||||
)
|
||||
stmt_insert_runid = DBInterface.prepare(
|
||||
db,
|
||||
sql"""
|
||||
|
@ -393,9 +401,24 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
if isnothing(run_metadata)
|
||||
continue
|
||||
end
|
||||
|
||||
if !isempty(DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)))
|
||||
current_rundb =
|
||||
DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)) |>
|
||||
DataFrame
|
||||
if !isempty(current_rundb.id)
|
||||
# runid is already in the database
|
||||
if any(ismissing, current_rundb.run_datetime)
|
||||
# add timestamp, logfile, ...etc
|
||||
DBInterface.execute(
|
||||
stmt_update_runid,
|
||||
(
|
||||
runid = run_metadata.runid,
|
||||
run_datetime = run_metadata.timestamp |> string,
|
||||
shifter = run_metadata.shifters,
|
||||
logfile = splitdir(longrun_log) |> last,
|
||||
shiftscript_ver = run_metadata.shiftscript_version,
|
||||
),
|
||||
)
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
|
@ -404,7 +427,7 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
|||
(
|
||||
runid = run_metadata.runid,
|
||||
campaign_id = get_campaign_id_from_run_id(run_metadata.runid),
|
||||
run_datetime = run_metadata.timestamp,
|
||||
run_datetime = run_metadata.timestamp |> string,
|
||||
note = "",
|
||||
shifter = run_metadata.shifters,
|
||||
logfile = splitdir(longrun_log) |> last,
|
||||
|
@ -516,7 +539,10 @@ function add_qaqc_100test_result(db::SQLite.DB, table::DataFrame)
|
|||
if DBInterface.execute(stmt_search_runid, (; runid = row.runid)) |> isempty
|
||||
# search for resistance error
|
||||
if !isempty(
|
||||
DBInterface.execute(stmt_search_resistance_error, (; psboard_id = row.motherboard_id)),
|
||||
DBInterface.execute(
|
||||
stmt_search_resistance_error,
|
||||
(; psboard_id = row.motherboard_id),
|
||||
),
|
||||
)
|
||||
continue
|
||||
end
|
||||
|
|
|
@ -95,25 +95,71 @@ CREATE TABLE qaqc_positions (
|
|||
CREATE VIEW qaqc_single_run_table
|
||||
AS
|
||||
SELECT
|
||||
qaqc_single_run_results.psboard_id,
|
||||
ps_boards.id AS psboard_id,
|
||||
qaqc_single_run_results.daughterboard_id,
|
||||
qaqc_positions.name,
|
||||
qaqc_single_run_results.runid,
|
||||
qaqc_runs.run_datetime,
|
||||
qaqc_runs.shiftscript_ver,
|
||||
qaqc_single_run_results.runid AS runid,
|
||||
qaqc_runs.run_datetime AS run_timestamp,
|
||||
qaqc_runs.shifter,
|
||||
qaqc_runs.note AS run_note,
|
||||
qaqc_positions.name as position,
|
||||
qaqc_single_run_results.qspip,
|
||||
qaqc_single_run_results.recov,
|
||||
qaqc_single_run_results.power,
|
||||
qaqc_single_run_results.clock,
|
||||
qaqc_single_run_results.asdtp,
|
||||
qaqc_single_run_results.reset,
|
||||
qaqc_single_run_results.qaqc_result
|
||||
qaqc_single_run_results.qaqc_result,
|
||||
qaqc_runs.shiftscript_ver,
|
||||
qaqc_runs.shifter,
|
||||
qaqc_single_run_results.note AS result_note
|
||||
FROM
|
||||
ps_boards,
|
||||
qaqc_single_run_results,
|
||||
qaqc_positions,
|
||||
qaqc_runs
|
||||
WHERE
|
||||
qaqc_positions.id = qaqc_single_run_results.position AND
|
||||
qaqc_runs.id = qaqc_single_run_results.runid;
|
||||
ps_boards.id = qaqc_single_run_results.psboard_id
|
||||
AND qaqc_single_run_results.runid = qaqc_runs.id
|
||||
AND qaqc_positions.id = qaqc_single_run_results.position
|
||||
-- AND ps_boards.id = 356
|
||||
ORDER BY
|
||||
qaqc_runs.run_datetime ASC,
|
||||
qaqc_positions.id;
|
||||
|
||||
CREATE VIEW qaqc_extra_run_table
|
||||
AS
|
||||
SELECT
|
||||
ps_boards.id AS psboard_id,
|
||||
qaqc_runs.id AS runid,
|
||||
qaqc_runs.run_datetime AS run_timestamp,
|
||||
qaqc_runs.shifter,
|
||||
qaqc_runs.note AS run_note,
|
||||
qaqc_positions.name as position,
|
||||
qaqc_extra_run_results.insufficient_reset_with_10,
|
||||
qaqc_extra_run_results.reset_failed_though_reconfig_done,
|
||||
qaqc_extra_run_results.always_hit_flag_true,
|
||||
qaqc_extra_run_results.dac_is_0,
|
||||
qaqc_extra_run_results.efficiency_99percent,
|
||||
qaqc_extra_run_results.bcid_shift,
|
||||
qaqc_extra_run_results.bcid_fail_000,
|
||||
qaqc_extra_run_results.bcid_fail_111,
|
||||
qaqc_extra_run_results.low_efficiency,
|
||||
qaqc_extra_run_results.bcid_fail,
|
||||
qaqc_extra_run_results.power_out_of_range,
|
||||
qaqc_extra_run_results.invalid_register_value,
|
||||
qaqc_runs.shiftscript_ver,
|
||||
qaqc_runs.shifter,
|
||||
qaqc_extra_run_results.note AS result_note
|
||||
FROM
|
||||
ps_boards,
|
||||
qaqc_extra_run_results,
|
||||
qaqc_positions,
|
||||
qaqc_runs
|
||||
WHERE
|
||||
ps_boards.id = qaqc_extra_run_results.psboard_id
|
||||
AND qaqc_extra_run_results.runid = qaqc_runs.id
|
||||
AND qaqc_positions.id = qaqc_extra_run_results.position
|
||||
ORDER BY
|
||||
qaqc_runs.id ASC,
|
||||
qaqc_positions.id;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue