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(
|
stmt_search_runid = DBInterface.prepare(
|
||||||
db,
|
db,
|
||||||
sql"""
|
sql"""
|
||||||
SELECT id
|
SELECT id, run_datetime
|
||||||
FROM qaqc_runs
|
FROM qaqc_runs
|
||||||
WHERE id = :runid
|
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(
|
stmt_insert_runid = DBInterface.prepare(
|
||||||
db,
|
db,
|
||||||
sql"""
|
sql"""
|
||||||
|
@ -393,9 +401,24 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
||||||
if isnothing(run_metadata)
|
if isnothing(run_metadata)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
current_rundb =
|
||||||
if !isempty(DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)))
|
DBInterface.execute(stmt_search_runid, (; runid = run_metadata.runid)) |>
|
||||||
|
DataFrame
|
||||||
|
if !isempty(current_rundb.id)
|
||||||
# runid is already in the database
|
# 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
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -404,7 +427,7 @@ function add_qaqc_runlist_from_masterlogs(db::SQLite.DB, logs_dir::AbstractStrin
|
||||||
(
|
(
|
||||||
runid = run_metadata.runid,
|
runid = run_metadata.runid,
|
||||||
campaign_id = get_campaign_id_from_run_id(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 = "",
|
note = "",
|
||||||
shifter = run_metadata.shifters,
|
shifter = run_metadata.shifters,
|
||||||
logfile = splitdir(longrun_log) |> last,
|
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
|
if DBInterface.execute(stmt_search_runid, (; runid = row.runid)) |> isempty
|
||||||
# search for resistance error
|
# search for resistance error
|
||||||
if !isempty(
|
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
|
continue
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,25 +95,71 @@ CREATE TABLE qaqc_positions (
|
||||||
CREATE VIEW qaqc_single_run_table
|
CREATE VIEW qaqc_single_run_table
|
||||||
AS
|
AS
|
||||||
SELECT
|
SELECT
|
||||||
qaqc_single_run_results.psboard_id,
|
ps_boards.id AS psboard_id,
|
||||||
qaqc_single_run_results.daughterboard_id,
|
qaqc_single_run_results.daughterboard_id,
|
||||||
qaqc_positions.name,
|
qaqc_single_run_results.runid AS runid,
|
||||||
qaqc_single_run_results.runid,
|
qaqc_runs.run_datetime AS run_timestamp,
|
||||||
qaqc_runs.run_datetime,
|
|
||||||
qaqc_runs.shiftscript_ver,
|
|
||||||
qaqc_runs.shifter,
|
qaqc_runs.shifter,
|
||||||
|
qaqc_runs.note AS run_note,
|
||||||
|
qaqc_positions.name as position,
|
||||||
qaqc_single_run_results.qspip,
|
qaqc_single_run_results.qspip,
|
||||||
qaqc_single_run_results.recov,
|
qaqc_single_run_results.recov,
|
||||||
qaqc_single_run_results.power,
|
qaqc_single_run_results.power,
|
||||||
qaqc_single_run_results.clock,
|
qaqc_single_run_results.clock,
|
||||||
qaqc_single_run_results.asdtp,
|
qaqc_single_run_results.asdtp,
|
||||||
qaqc_single_run_results.reset,
|
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
|
FROM
|
||||||
|
ps_boards,
|
||||||
qaqc_single_run_results,
|
qaqc_single_run_results,
|
||||||
qaqc_positions,
|
qaqc_positions,
|
||||||
qaqc_runs
|
qaqc_runs
|
||||||
WHERE
|
WHERE
|
||||||
qaqc_positions.id = qaqc_single_run_results.position AND
|
ps_boards.id = qaqc_single_run_results.psboard_id
|
||||||
qaqc_runs.id = qaqc_single_run_results.runid;
|
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