Update notebooks

This commit is contained in:
Wataru Otsubo 2025-04-15 09:05:14 +00:00
parent 2c9aaed850
commit a42bf07e7c
15 changed files with 7253 additions and 2103 deletions

View file

@ -1,5 +1,5 @@
### A Pluto.jl notebook ###
# v0.20.2
# v0.20.4
using Markdown
using InteractiveUtils
@ -28,6 +28,9 @@ SQLite.tables(db)
qaqc_single_run_results =
DBInterface.execute(db, "select * from qaqc_single_run_results") |> DataFrame
# ╔═╡ 7a86a76d-7a69-4549-9998-36182e312ca7
num_premassproduction = filter(:psboard_id => <(100), qaqc_single_run_results).psboard_id |> unique |> length
# ╔═╡ 0467fb45-6b97-4148-8343-0e4b06a7c2ec
qaqc_runs = let
df = DBInterface.execute(db, "select * from qaqc_runs") |> DataFrame
@ -68,6 +71,7 @@ df_num_tested_boards = let
)
sort!(df, :runid)
df = combine(groupby(df, :psboard_id), first)
@info "" df nrow(df) filter(:psboard_id => <(100), df)
df = combine(
groupby(df, :campaign_id),
:psboard_id => length unique => :num_tested_boards,
@ -81,6 +85,9 @@ end
# ╔═╡ fa7565e0-2662-4f2c-8e1c-8f6158557d58
df_num_dispatched = let
df = combine(groupby(qaqc_dispatch, :qaqc_campaign_id), nrow => :num_dispatched)
transform!(df, :qaqc_campaign_id => ByRow(Float64) => :qaqc_campaign_id)
# TODO: remove this later when dispatch table is updated
push!(df, (qaqc_campaign_id = 7.5, num_dispatched = 11))
df.num_total_dispatched = accumulate(+, df.num_dispatched)
df = leftjoin(df, qaqc_campaigns, on = :qaqc_campaign_id => :id)
disallowmissing!(df, :end_date)
@ -90,13 +97,14 @@ end
# ╔═╡ 8a2ae739-0da0-49cc-9614-74ac7e133599
let
fig = Figure(size = (600, 400))
ax = Axis(fig[1, 1], limits = (nothing, (0, 1500)), title = "PS-Board QAQC progress")
ax = Axis(fig[1, 1], limits = (nothing, (0, 1600)), title = "PS board QAQC progress")
n_campaings = nrow(df_num_dispatched)
num_testeds = let
v = df_num_tested_boards.num_total_tested |> copy
hcat([0, v[1:(end - 1)]...], v) |> transpose |> (a -> reshape(a, 2 * n_campaings))
end
num_testeds[2:end] .= num_testeds[2:end] .- num_premassproduction
num_dispatched = let
v = df_num_dispatched.num_total_dispatched |> copy
hcat([0, v[1:(end - 1)]...], v) |> transpose |> (a -> reshape(a, 2 * n_campaings))
@ -106,26 +114,27 @@ let
reshape(df_num_dispatched.start_date, (1, n_campaings)),
reshape(df_num_dispatched.end_date, (1, n_campaings)),
) |>
(a -> reshape(a, 12)) |>
(a -> reshape(a, 16)) |>
skipmissing |>
collect
@info "" num_testeds num_dispatched
lines!(ax, start_end_dates, num_testeds, label = "tested")
lines!(ax, start_end_dates, num_dispatched, label = "passed")
middle_dates = let
starts = df_num_dispatched.start_date
@. (df_num_dispatched.end_date - starts) / 2 + starts
end
text!(
ax,
middle_dates,
df_num_tested_boards.num_total_tested,
text = ["1st", "2nd", "3rd", ("$(i)th" for i in 4:n_campaings)...],
align = (:center, :bottom),
)
middle_dates = let
starts = df_num_dispatched.start_date
@. (df_num_dispatched.end_date - starts) / 2 + starts
end
text!(
ax,
middle_dates,
df_num_tested_boards.num_total_tested,
text = ["1st", "2nd", "3rd", ("$(i)th" for i in 4:(n_campaings - 1))..., ""],
align = (:center, :bottom),
)
axislegend(position = :rb)
save("qaqc_progress.svg", fig)
hlines!(ax, 1480, color = Makie.wong_colors()[3])
save("qaqc_progress.svg", fig)
fig
end
@ -136,6 +145,7 @@ end
# ╠═436f0b91-4cc8-4c22-b625-cfd4779e20ec
# ╠═085176e5-c0f9-4cf2-8416-581a8d20c941
# ╠═363afd96-5b0d-4b09-b480-64a40ddce8cd
# ╠═7a86a76d-7a69-4549-9998-36182e312ca7
# ╠═0467fb45-6b97-4148-8343-0e4b06a7c2ec
# ╠═4c30b33a-e15e-4b3c-a0f5-50184e7a711f
# ╠═560bbdc3-26a4-4fe9-8459-e5ecaad04082