diff --git a/docs/Manifest.toml b/docs/Manifest.toml index a8f999f..cd9edd1 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.5" manifest_format = "2.0" -project_hash = "d21eb427146f0385a60bcaf127a2c0e4878b044b" +project_hash = "ee8312616d887d85f460636f9710488be4490a26" [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" @@ -87,6 +87,12 @@ version = "1.0.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +[[deps.DocInventories]] +deps = ["CodecZlib", "Downloads", "TOML"] +git-tree-sha1 = "e97cfa8680a39396924dcdca4b7ff1014ed5c499" +uuid = "43dc2714-ed3b-44b5-b226-857eda1aa7de" +version = "1.0.0" + [[deps.DocStringExtensions]] deps = ["LibGit2"] git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" @@ -99,6 +105,18 @@ git-tree-sha1 = "5a1ee886566f2fa9318df1273d8b778b9d42712d" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" version = "1.7.0" +[[deps.DocumenterInterLinks]] +deps = ["CodecZlib", "DocInventories", "Documenter", "DocumenterInventoryWritingBackport", "Markdown", "MarkdownAST", "TOML"] +git-tree-sha1 = "00dceb038f6cb24f4d8d6a9f2feb85bbe58305fd" +uuid = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656" +version = "1.0.0" + +[[deps.DocumenterInventoryWritingBackport]] +deps = ["CodecZlib", "Documenter", "TOML"] +git-tree-sha1 = "1b89024e375353961bb98b9818b44a4e38961cc4" +uuid = "195adf08-069f-4855-af3e-8933a2cdae94" +version = "0.1.0" + [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" diff --git a/docs/Project.toml b/docs/Project.toml index 96ec75e..51cb888 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,5 @@ [deps] +DocInventories = "43dc2714-ed3b-44b5-b226-857eda1aa7de" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656" PSBoardDataBase = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5" diff --git a/docs/make.jl b/docs/make.jl index 3c93e6b..c10cc7a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,6 +1,14 @@ using Documenter, PSBoardDataBase +using DocumenterInterLinks -DocMeta.setdocmeta!(PSBoardDataBase, :DocTestSetup, :(using PSBoardDataBase); recursive = true) +DocMeta.setdocmeta!( + PSBoardDataBase, + :DocTestSetup, + :(using PSBoardDataBase); + recursive = true, +) + +links = InterLinks("DataFrames" => "https://dataframes.juliadata.org/dev/objects.inv") makedocs( modules = [PSBoardDataBase], @@ -12,7 +20,8 @@ makedocs( assets = String[], ), repo = Remotes.GitLab("https://gitlab.cern.ch", "wotsubo", "PSBoardDataBase"), - pages = [ - "Home" => "index.md", - ] + pages = ["Home" => "index.md", "About this software" => "about_software.md"], + plugins = [links], ) + +deploydocs(repo = "gitlab.cern.ch/wotsubo/PSBoardDataBase", devbranch = "main") diff --git a/docs/src/about_software.md b/docs/src/about_software.md new file mode 100644 index 0000000..cbcbeaf --- /dev/null +++ b/docs/src/about_software.md @@ -0,0 +1,29 @@ +```@meta +CurrentModule = PSBoardDataBase +``` +# このリポジトリのソフトウェアについての説明 + +このリポジトリにあるのは、JATHub masterのログファイル、及びGoogle SheetsからエクスポートしたCSVファイルからデータベースを作成するためのコードである。 +メインの関数は[`create_database_from_exported_csvs`](@ref)である。 + +## テストについて + +テストでは実際にデータベースを作成している。 +デフォルトでは全部は実行しないが、master log fileをおき、かつ環境変数`LOCAL_TEST`を設定することで、master log fileが必要な工程まで含めて実行できる。[^1] + +[^1]: master log fileはgitには入れたくないので、このような形態をとっている。 + +## API + +```@index +``` + +```@autodocs +Modules = [PSBoardDataBase] +``` + +### `QaqcMasterLog` + +```@autodocs +Modules = [QaqcMasterLog] +``` diff --git a/docs/src/assets/sqlite-db.svg b/docs/src/assets/sqlite-db.svg new file mode 100644 index 0000000..ddc4dce --- /dev/null +++ b/docs/src/assets/sqlite-db.svg @@ -0,0 +1 @@ +
id
integer
daughterboard_id
integer
id
integer
start_date
datetime
end_date
datetime
note
text
id
integer
qaqc_campaign_id
integer
psb_id
integer
source_place
text
destination
text
time
datetime
id
integer
runid
integer
psboard_id
integer
position
integer
num_tests
integer
insufficient_reset_with_10
integer
reset_failed_though_reconfig_done
integer
always_hit_flag_true
integer
dac_is_0
integer
bcid_shift
integer
efficiency_99percent
integer
bcid_fail_111
integer
bcid_fail_000
integer
low_efficiency
integer
bcid_fail
integer
invalid_register_value
integer
power_out_of_range
integer
note
text
Show Less
id
integer
name
text
station
integer
position
integer
id
integer
psb_id
integer
passed
boolean
id
integer
campaign_id
integer
run_datetime
datetime
note
text
shifter
text
logfile
text
shiftscript_ver
text
id
integer
runid
integer
psboard_id
integer
daughterboard_id
integer
position
integer
resistance_test_passed
boolean
qspip
integer
recov
integer
power
integer
clock
integer
asdtp
integer
reset
integer
qaqc_result
integer
note
text
Show Less
name
seq
\ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index 6a79cb5..3604a92 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,20 +1,410 @@ -```@meta -CurrentModule = PSBoardDataBase +# データベースについて + +このリポジトリは、PS BoardのQAQC結果を主に管理するデータベースを扱ってる。 + +## データベースの特徴 + +現時点(2024-09-13)でQAQC試験は[Google Sheetsで作成したデータベース](https://docs.google.com/spreadsheets/d/128qOseOy4QDotehYe4Wf2jj88tnwiXGVdR3NHrjcDYU/edit)でデータが管理されているが、主にデータを統合して参照するときに手作業が多く必要となり、エラーが発生する問題があった。 +そこで[リレーショナルデータベース](https://ja.wikipedia.org/wiki/関係データベース)の形式にすることでより体系的にデータを扱えるようにしたのがこのリポジトリである。 + +データベースは[SQLite](https://www.sqlite.org/index.html)で実装されており、軽量かつ様々な手段によるアクセスが可能となっている。 + +## アクセス方法 +データベースはファイルとして存在するので、そのファイルにアクセスできればよい。[^1][^2] +ファイルは _TODO_ で手に入る。 + +データベースを読み書きするためにはライブラリが必要で、問い合わせは[SQL](https://ja.wikipedia.org/wiki/SQL)によって行うが、ラッパーを使うこともできる。 +以下に使いやすいであろうライブラリ/パッケージを列挙する。[^3] + +- [sqlite3(コマンドラインプログラム)](https://www.sqlite.org/cli.html): 公式の提供するCLI。どこでも動く。CSVでのエクスポートもできる。 +- [DB Browser for SQLite](https://sqlitebrowser.org): クロスプラットフォームプレイなデスクトップアプリケーション。最も簡単。 +- [Python sqlite3](https://docs.python.org/ja/3/library/sqlite3.html): Pythonの標準ライブラリ。すなわち(C)Pythonが入ってるならたいてい入っている。 +- [SQLite Viewer Web App](https://sqliteviewer.app/), [beta版](https://beta.sqliteviewer.app/psboard_qaqc.db/table/qaqc_runs): ブラウザで動く。最も手軽。 +- [SQLite.jl](https://github.com/JuliaDatabases/SQLite.jl/tree/master): Juliaのパッケージ。[Tables.jl](https://github.com/JuliaData/Tables.jl)準拠なため、[DataFrame](https://github.com/JuliaData/DataFrames.jl)やCSVに/から変換できる。 _この実装で用いられている。_ +- [SQLite Studio](https://sqlitestudio.pl): デスクトップアプリケーション。 +- [ROOT TSQLFile Class](https://root.cern.ch/doc/master/classTSQLFile.html): ROOTのTFile派生クラス。[チュートリアル](https://root.cern.ch/doc/master/group__tutorial__sql.html) + +他にも[diesel](https://diesel.rs)や[SQLAlchemy](https://www.sqlalchemy.org)のようなORM、C/C++, tcl(いずれも[公式のチュートリアル](https://sqlite.org/quickstart.html)に載っている)、[LuaSQLite3](http://lua.sqlite.org/index.cgi/index)、[ODBCドライバ](http://www.ch-werner.de/sqliteodbc/)とODBCでアクセスできるソフト([LibreOffice Base](https://www.libreoffice.org/DISCOVER/BASE/)や[Microsoft Access](https://support.microsoft.com/ja-jp/topic/odbc-データ-ソースを管理する-b19f856b-5b9b-48c9-8b93-07484bfab5a7))でもアクセスできる。 + +[^1]: 大抵の関係データベース(たとえばPostgres)はサーバーでホストし、TCPでアクセスする +[^2]: [sqlsync](https://github.com/orbitinghail/sqlsync)によるオンラインアクセスやRESTサーバーなどによるアクセスの案もある +[^3]: このようなプログラムはいくらでもある + +## データベースの構造 +![](./assets/sqlite-db.svg) + +四角がテーブル、その中にコラム、線でつながっているのが*FOREIGN KEY*制約を表している。 + +データベース作成SQLは`src/sql/create_table.sql`にある。 + +## 例 + +### 本番1回試験のテーブルを再現する + +[本番1回試験のテーブル](https://docs.google.com/spreadsheets/d/128qOseOy4QDotehYe4Wf2jj88tnwiXGVdR3NHrjcDYU/edit?pli=1&gid=408695746#gid=408695746)の情報は、 +このデータベースでは主にQAQCのrunのテーブル`qaqc_runs`と一回試験結果のテーブル`qaqc_single_run_results`を参照することで得られる。 +そのためのSQLは +```sql +SELECT + qaqc_single_run_results.psboard_id, + qaqc_single_run_results.runid AS runid, + qaqc_runs.run_datetime AS run_timestamp, + qaqc_runs.shifter, + qaqc_runs.note AS run_note, + 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_runs.shifter, + qaqc_single_run_results.note AS result_note +FROM + qaqc_single_run_results, + qaqc_runs +WHERE + qaqc_single_run_results.runid = qaqc_runs.id +ORDER BY + qaqc_runs.run_datetime +LIMIT 10; +``` +である。 +sqlite3 cliで試してみる。 +```sh +$ sqlite3 psboard_qaqc.db +SQLite version 3.46.1 2024-08-13 09:16:08 +Enter ".help" for usage hints. +sqlite> SELECT + qaqc_single_run_results.psboard_id, + qaqc_single_run_results.runid AS runid, + qaqc_runs.run_datetime AS run_timestamp, + qaqc_runs.shifter, + qaqc_runs.note AS run_note, + 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_runs.shifter, + qaqc_single_run_results.note AS result_note +FROM + qaqc_single_run_results, + qaqc_runs +WHERE + qaqc_single_run_results.runid = qaqc_runs.id +ORDER BY + qaqc_runs.run_datetime +LIMIT 10; +76|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto|BCID fail, BCID shift, BCID failは1回, PP ASIC 2のPLLLDが0なのにreset counterが0が1回, PPconfig_doneが立っていないが1回→新基準でクリア +75|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|2|0|2|hashimoto|always_hit_flag が立つが1回 +74|24|2024-07-24T04:18:46|hashimoto||1|1|2|1|1|0|2|hashimoto|DAC read = 0 +73|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto| +68|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto| +67|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|1|1|hashimoto|PP ASIC 3でhit efficiencyが99%が29回 +66|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto|PLLLDが0なのにreset counterが0が1回 +65|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto| +60|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|6|1|hashimoto|PPconfig_doneが 立っていないが1回 +59|24|2024-07-24T04:18:46|hashimoto||1|1|1|1|1|0|1|hashimoto|PPconfig_doneが 立っていないが1回 +sqlite> +``` +より複雑なものがVIEW qaqc_single_run_resultsとして用意されているので、`select * from qaqc_single_run_results;`をすれば結果が見れる。 + +### Juliaでの例 +Juliaで試してみる。 +まずは環境を有効化(このリポジトリのルートで)。 +```julia +julia> pwd() |> splitpath |> last +"PSBoardDataBase" + +(@v1.10) pkg> activate . + ... + +(PSBoardDataBase) pkg> instantiate +Precompiling project... + ✓ PSBoardDataBase + 1 dependency successfully precompiled in 3 seconds. 58 already precompiled. + 1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version ``` -# About - -## API - -```@index +パッケージの読み込み。 +```julia +julia> using DataFrames, SQLite, DBInterface ``` -```@autodocs -Modules = [PSBoardDataBase] -``` +データベースへの接続とSQLの実行。 +[`DataFrames.DataFrame`](@extref)で出力している。 +```julia +julia> db = DBInterface.connect(SQLite.DB, "psboard_qaqc.db") +SQLite.DB("psboard_qaqc.db") + +julia> DBInterface.execute( + db, + sql""" + SELECT + qaqc_single_run_results.psboard_id, + qaqc_single_run_results.runid AS runid, + qaqc_runs.run_datetime AS run_timestamp, + qaqc_runs.shifter, + qaqc_runs.note AS run_note, + 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_runs.shifter, + qaqc_single_run_results.note AS result_note + FROM + qaqc_single_run_results, + qaqc_runs + WHERE + qaqc_single_run_results.runid = qaqc_runs.id + ORDER BY + qaqc_runs.run_datetime + LIMIT 10; + """ + ) |> DataFrame +10×14 DataFrame + Row │ psboard_id runid run_timestamp shifter run_note qspip recov power clock asdtp reset qaqc_result ⋯ + │ Int64 Int64 String String String Int64 Int64 Int64 Int64 Int64 Int64 Int64 ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 76 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 ⋯ + 2 │ 75 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 2 0 2 + 3 │ 74 24 2024-07-24T04:18:46 hashimoto 1 1 2 1 1 0 2 + 4 │ 73 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 + 5 │ 68 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 ⋯ + 6 │ 67 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 1 1 + 7 │ 66 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 + 8 │ 65 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 + 9 │ 60 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 6 1 ⋯ + 10 │ 59 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 1 0 1 + 2 columns omitted +``` +特定のpositionの結果だけをまとめ、shifterごとの数を数える。 +まずはパラメーターを埋め込んだクエリを用意(コンパイル)する。 +```julia +julia> stmt = DBInterface.prepare( + db, + sql""" + SELECT + qaqc_single_run_results.psboard_id, + qaqc_single_run_results.runid AS runid, + qaqc_runs.run_datetime AS run_timestamp, + qaqc_runs.shifter, + qaqc_runs.note AS run_note, + 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_runs.shifter, + qaqc_single_run_results.note AS result_note + FROM + qaqc_single_run_results, + qaqc_runs + WHERE + qaqc_single_run_results.runid = qaqc_runs.id + AND qaqc_single_run_results.position = (:position) + ORDER BY + qaqc_runs.run_datetime + """ + ) +SQLite.Stmt(SQLite.DB("psboard_qaqc.db"), Base.RefValue{Ptr{SQLite.C.sqlite3_stmt}}(Ptr{SQLite.C.sqlite3_stmt} @0x0000000026ab73b8), Dict{Int64, Any}()) +``` +次にそのクエリをパラメーターとともに実行する。 +```julia +julia> df = DBInterface.execute(stmt, (; position = 3)) |> DataFrame +34×14 DataFrame + Row │ psboard_id runid run_timestamp shifter run_note qspip recov po ⋯ + │ Int64 Int64 String String String Int64 Int64 In ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 51 24 2024-07-24T04:18:46 hashimoto 1 1 ⋯ + 2 │ 47 25 2024-07-24T05:15:02 Hashimoto,Otsubo,Sube 1 1 + 3 │ 80 29 2024-07-24T10:12:44 Otsubo,Kondo 1 1 + 4 │ 180 30 2024-07-24T11:08:10 sube 1 1 + 5 │ 113 32 2024-07-25T00:25:45 Izumiyama,Sube 1 1 ⋯ + 6 │ 171 35 2024-07-25T02:35:01 Izumiyama,Sube 1 1 + 7 │ 129 39 2024-07-25T05:19:04 sube Run 38 後に station1 系統を再起 … 1 1 + 8 │ 150 41 2024-07-25T06:53:20 Airu Makita 1 1 + 9 │ 212 43 2024-07-25T08:22:25 amakita 1 1 ⋯ + 10 │ 232 47 2024-07-25T10:54:11 hashimoto 1 1 + 11 │ 165 51 2024-07-25T12:45:19 hashimoto Only Clock試験を実施 0 0 + 12 │ 321 66 2024-08-06T03:49:29 hashimoto QA/QC第1弾でFirmwareだけ書いてい… 1 1 + 13 │ 338 71 2024-08-06T08:02:09 sube ソフトウェアリセット修正版のFirm… 1 1 ⋯ + 14 │ 277 72 2024-08-06T08:42:13 sube 通常の1回試験 1 1 + 15 │ 357 75 2024-08-06T11:05:22 sube 通常の1回試験 1 1 + 16 │ 346 78 2024-08-07T00:33:06 hashimoto 通常の1回試験 1 1 + 17 │ 383 81 2024-08-07T03:21:13 hashimoto 通常の1回試験 1 1 ⋯ + 18 │ 241 83 2024-08-07T04:39:42 skondo 通常の1回試験 1 1 + 19 │ 255 85 2024-08-07T06:18:09 makita 通常の1回試験 3 1 + 20 │ 375 87 2024-08-07T07:44:16 makita 通常の1回試験 1 1 + 21 │ 44 89 2024-08-08T02:49:55 sube B-0-3, B-1-3, B-0-2, B-1-2はDAC=… 1 1 ⋯ + 22 │ 393 94 2024-08-09T01:08:51 kondo 追試(1回試験) 1 1 + 23 │ 403 98 2024-09-10T03:49:53 otsubo 通常の1回試験 のつもりがSDカード… 1 1 + 24 │ 421 100 2024-09-10T06:15:35 tagami 通常の1回試験 1 1 + 25 │ 439 103 2024-09-10T07:32:45 tagami 通常の1回試験 1 1 ⋯ + 26 │ 457 105 2024-09-10T08:38:26 tagami 通常の1回試験 1 1 + 27 │ 475 107 2024-09-10T10:03:58 tagami 通常の1回試験 1 1 + 28 │ 493 117 2024-09-11T02:13:40 tagami 通常の1回試験(station 1 JatHub … 1 1 + 29 │ 511 120 2024-09-11T03:41:25 tagami 通常の1回試験 1 1 ⋯ + 30 │ 529 122 2024-09-11T05:04:29 kmaki 通常の1回試験 1 1 + 31 │ 547 126 2024-09-11T06:30:42 tagami 通常の1回試験 1 1 + 32 │ 564 128 2024-09-11T07:32:48 tagami 通常の1回試験 1 1 + 33 │ 582 130 2024-09-11T08:25:46 muzuochi 通常の1回試験 1 1 ⋯ + 34 │ 491 132 2024-09-12T02:31:20 tagami 1回試験追試。メザニン交換5台+cl… 1 1 + 7 columns omitted +``` +日付の型を変換する。 +```julia +julia> transform!(df, :run_timestamp => ByRow(DateTime) => :run_timestamp) +34×14 DataFrame + Row │ psboard_id runid run_timestamp shifter run_note qspip recov po ⋯ + │ Int64 Int64 DateTime String String Int64 Int64 In ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 51 24 2024-07-24T04:18:46 hashimoto 1 1 ⋯ + 2 │ 47 25 2024-07-24T05:15:02 Hashimoto,Otsubo,Sube 1 1 + 3 │ 80 29 2024-07-24T10:12:44 Otsubo,Kondo 1 1 + 4 │ 180 30 2024-07-24T11:08:10 sube 1 1 + 5 │ 113 32 2024-07-25T00:25:45 Izumiyama,Sube 1 1 ⋯ + 6 │ 171 35 2024-07-25T02:35:01 Izumiyama,Sube 1 1 + 7 │ 129 39 2024-07-25T05:19:04 sube Run 38 後に station1 系統を再起 … 1 1 + 8 │ 150 41 2024-07-25T06:53:20 Airu Makita 1 1 + 9 │ 212 43 2024-07-25T08:22:25 amakita 1 1 ⋯ + 10 │ 232 47 2024-07-25T10:54:11 hashimoto 1 1 + 11 │ 165 51 2024-07-25T12:45:19 hashimoto Only Clock試験を実施 0 0 + 12 │ 321 66 2024-08-06T03:49:29 hashimoto QA/QC第1弾でFirmwareだけ書いてい… 1 1 + 13 │ 338 71 2024-08-06T08:02:09 sube ソフトウェアリセット修正版のFirm… 1 1 ⋯ + 14 │ 277 72 2024-08-06T08:42:13 sube 通常の1回試験 1 1 + 15 │ 357 75 2024-08-06T11:05:22 sube 通常の1回試験 1 1 + 16 │ 346 78 2024-08-07T00:33:06 hashimoto 通常の1回試験 1 1 + 17 │ 383 81 2024-08-07T03:21:13 hashimoto 通常の1回試験 1 1 ⋯ + 18 │ 241 83 2024-08-07T04:39:42 skondo 通常の1回試験 1 1 + 19 │ 255 85 2024-08-07T06:18:09 makita 通常の1回試験 3 1 + 20 │ 375 87 2024-08-07T07:44:16 makita 通常の1回試験 1 1 + 21 │ 44 89 2024-08-08T02:49:55 sube B-0-3, B-1-3, B-0-2, B-1-2はDAC=… 1 1 ⋯ + 22 │ 393 94 2024-08-09T01:08:51 kondo 追試(1回試験) 1 1 + 23 │ 403 98 2024-09-10T03:49:53 otsubo 通常の1回試験 のつもりがSDカード… 1 1 + 24 │ 421 100 2024-09-10T06:15:35 tagami 通常の1回試験 1 1 + 25 │ 439 103 2024-09-10T07:32:45 tagami 通常の1回試験 1 1 ⋯ + 26 │ 457 105 2024-09-10T08:38:26 tagami 通常の1回試験 1 1 + 27 │ 475 107 2024-09-10T10:03:58 tagami 通常の1回試験 1 1 + 28 │ 493 117 2024-09-11T02:13:40 tagami 通常の1回試験(station 1 JatHub … 1 1 + 29 │ 511 120 2024-09-11T03:41:25 tagami 通常の1回試験 1 1 ⋯ + 30 │ 529 122 2024-09-11T05:04:29 kmaki 通常の1回試験 1 1 + 31 │ 547 126 2024-09-11T06:30:42 tagami 通常の1回試験 1 1 + 32 │ 564 128 2024-09-11T07:32:48 tagami 通常の1回試験 1 1 + 33 │ 582 130 2024-09-11T08:25:46 muzuochi 通常の1回試験 1 1 ⋯ + 34 │ 491 132 2024-09-12T02:31:20 tagami 1回試験追試。メザニン交換5台+cl… 1 1 + 7 columns omitted +``` +シフターごとにグループ化。 +```julia +julia> gdf = groupby(df, :shifter) +GroupedDataFrame with 14 groups based on key: shifter +First Group (6 rows): shifter = "hashimoto" + Row │ psboard_id runid run_timestamp shifter run_note qspip recov power clock ⋯ + │ Int64 Int64 DateTime String String Int64 Int64 Int64 Int64 ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 51 24 2024-07-24T04:18:46 hashimoto 1 1 1 1 ⋯ + 2 │ 232 47 2024-07-25T10:54:11 hashimoto 1 1 1 1 + ⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ + 5 │ 346 78 2024-08-07T00:33:06 hashimoto 通常の1回試験 1 1 1 1 + 6 │ 383 81 2024-08-07T03:21:13 hashimoto 通常の1回試験 1 1 1 1 + 5 columns and 2 rows omitted +⋮ +Last Group (1 row): shifter = "muzuochi" + Row │ psboard_id runid run_timestamp shifter run_note qspip recov power clock asdtp reset qaqc_re ⋯ + │ Int64 Int64 DateTime String String Int64 Int64 Int64 Int64 Int64 Int64 Int64 ⋯ + ⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ + 3 columns and 1 row omitted +``` +グループごとに行数を数えて集計。 +```julia +julia> combine(gdf, nrow) +14×2 DataFrame + Row │ shifter nrow + │ String Int64 +─────┼────────────────────────────── + 1 │ hashimoto 6 + 2 │ Hashimoto,Otsubo,Sube 1 + 3 │ Otsubo,Kondo 1 + 4 │ sube 6 + 5 │ Izumiyama,Sube 2 + 6 │ Airu Makita 1 + 7 │ amakita 1 + 8 │ skondo 1 + 9 │ makita 2 + 10 │ kondo 1 + 11 │ otsubo 1 + 12 │ tagami 9 + 13 │ kmaki 1 + 14 │ muzuochi 1 +``` +8月以降の結果を取得(データフレームを上書き)。 +```julia +julia> filter!(:run_timestamp => >(Date(2024, 8)), df) +23×14 DataFrame + Row │ psboard_id runid run_timestamp shifter run_note qspip recov power clock ⋯ + │ Int64 Int64 DateTime String String Int64 Int64 Int64 Int64 ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 321 66 2024-08-06T03:49:29 hashimoto QA/QC第1弾でFirmwareだけ書いてい… 1 1 1 1 ⋯ + 2 │ 338 71 2024-08-06T08:02:09 sube ソフトウェアリセット修正版のFirm… 1 1 1 1 + 3 │ 277 72 2024-08-06T08:42:13 sube 通常の1回試験 1 1 1 1 + 4 │ 357 75 2024-08-06T11:05:22 sube 通常の1回試験 1 1 1 1 + 5 │ 346 78 2024-08-07T00:33:06 hashimoto 通常の1回試験 1 1 1 1 ⋯ + 6 │ 383 81 2024-08-07T03:21:13 hashimoto 通常の1回試験 1 1 1 1 + 7 │ 241 83 2024-08-07T04:39:42 skondo 通常の1回試験 1 1 1 1 + 8 │ 255 85 2024-08-07T06:18:09 makita 通常の1回試験 3 1 2 3 + 9 │ 375 87 2024-08-07T07:44:16 makita 通常の1回試験 1 1 1 1 ⋯ + 10 │ 44 89 2024-08-08T02:49:55 sube B-0-3, B-1-3, B-0-2, B-1-2はDAC=… 1 1 1 1 + 11 │ 393 94 2024-08-09T01:08:51 kondo 追試(1回試験) 1 1 1 1 + 12 │ 403 98 2024-09-10T03:49:53 otsubo 通常の1回試験 のつもりがSDカード… 1 1 1 1 + 13 │ 421 100 2024-09-10T06:15:35 tagami 通常の1回試験 1 1 1 1 ⋯ + 14 │ 439 103 2024-09-10T07:32:45 tagami 通常の1回試験 1 1 1 1 + 15 │ 457 105 2024-09-10T08:38:26 tagami 通常の1回試験 1 1 1 1 + 16 │ 475 107 2024-09-10T10:03:58 tagami 通常の1回試験 1 1 1 1 + 17 │ 493 117 2024-09-11T02:13:40 tagami 通常の1回試験(station 1 JatHub … 1 1 1 1 ⋯ + 18 │ 511 120 2024-09-11T03:41:25 tagami 通常の1回試験 1 1 1 1 + 19 │ 529 122 2024-09-11T05:04:29 kmaki 通常の1回試験 1 1 1 1 + 20 │ 547 126 2024-09-11T06:30:42 tagami 通常の1回試験 1 1 1 1 + 21 │ 564 128 2024-09-11T07:32:48 tagami 通常の1回試験 1 1 1 1 ⋯ + 22 │ 582 130 2024-09-11T08:25:46 muzuochi 通常の1回試験 1 1 1 1 + 23 │ 491 132 2024-09-12T02:31:20 tagami 1回試験追試。メザニン交換5台+cl… 1 1 1 1 + 5 columns omitted +``` +列名を取得。 +```julia +julia> names(df) +14-element Vector{String}: + "psboard_id" + "runid" + "run_timestamp" + "shifter" + "run_note" + "qspip" + "recov" + "power" + "clock" + "asdtp" + "reset" + "qaqc_result" + "shifter_1" + "result_note" +``` +試験をパスしなかったものを選択。 +```julia +julia> filter(:qaqc_result => !=(1), df) +1×14 DataFrame + Row │ psboard_id runid run_timestamp shifter run_note qspip recov power clock asdtp reset qaqc_res ⋯ + │ Int64 Int64 DateTime String String Int64 Int64 Int64 Int64 Int64 Int64 Int64 ⋯ +─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + 1 │ 255 85 2024-08-07T06:18:09 makita 通常の1回試験 3 1 2 3 2 2 ⋯ + 3 columns omitted -### `QaqcMasterLog` - -```@autodocs -Modules = [QaqcMasterLog] ```