Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • add-types
  • ci-run-on-release
  • dispatch-check
  • main
  • v0.1.0
  • v0.2.0
  • v0.3.0
  • v0.3.1
  • v0.4.0
  • v0.5.0
  • v0.5.1
  • v1.0.0
12 results

Target

Select target project
  • wotsubo/PSBoardDataBase
1 result
Select Git revision
  • add-types
  • ci-run-on-release
  • dispatch-check
  • main
  • v0.1.0
  • v0.2.0
  • v0.3.0
  • v0.3.1
  • v0.4.0
  • v0.5.0
  • v0.5.1
  • v1.0.0
12 results
Show changes
Commits on Source (43)
Showing
with 913 additions and 525 deletions
......@@ -52,7 +52,8 @@ pages:
- mkdir -p public
- mv docs/build public/dev
- ls docs/src -R
- mv docs/src/assets/*.html public
- mkdir -p public/notebooks
- mv docs/src/assets/*.html public/notebooks
artifacts:
paths:
- public
......
......@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.3.0] - 2024-11-12
### Added
- Add `SlaveLogParser` module which contains parser of JATHub slave log
- Add slave log asdtp section parser
- Add slave log power section parser
- Add example Pluto notebook for power result analysis
- Add tutorial documentation
- Add tutorial for DispatchChecker and simple result browser
### Changed
- Exported notebooks are now deployed under notebooks url
- Moved examples in index.md of documentation to a dedicated page
### Fixed
- Converter version is filled during `create_database_from_exported_csvs`
## [0.2.0] - 2024-10-23
- Julia v1.11 was released and v1.10 is new LTS
......@@ -45,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Docs on the database and example of querying the database.
- Docs on the internal (Julia implementation)
[unreleased]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/-/compare/v0.2.0...main
[0.2.0]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/~/compare/v0.1.0...v0.2.0
[unreleased]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/-/compare/v0.3.0...main
[0.3.0]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/-/compare/v0.2.0...v0.3.0
[0.2.0]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/-/compare/v0.1.0...v0.2.0
[0.1.0]: https://gitlab.cern.ch/wotsubo/PSBoardDataBase/~/tags/v0.1.0
name = "PSBoardDataBase"
uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
authors = ["Wataru Otsubo <wotsubo@icepp.s.u-tokyo.ac.jp>"]
version = "0.2.0"
version = "0.3.0"
[deps]
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
......@@ -12,6 +13,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
[weakdeps]
......@@ -21,16 +23,25 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
PSBoardDataBaseInteractiveUtilsExt = "InteractiveUtils"
[compat]
julia = "1.10"
Aqua = "0.8"
AutoHashEquals = "2.2"
CSV = "0.10"
DBInterface = "2"
DataFrames = "1"
Documenter = "1"
Dates = "1.10"
Documenter = "1.7"
Downloads = "1"
InteractiveUtils = "1.10"
Printf = "1.10"
SQLite = "1"
StaticArrays = "1.9"
Tables = "1"
Test = "1.10"
[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
test = ["Test"]
test = ["Aqua", "Test"]
......@@ -10,5 +10,6 @@ PS Boardに関する(特にQAQCの結果に関する)データベース。
PS Board QAQCに関しては[こちら](https://gitlab.cern.ch/dhashimo/PS_Board_QAQC)
解析結果の例
- 結果一覧閲覧用簡易アプリケーション: https://psboard-database.docs.cern.ch/get_results.html
- skewを複数回測定した個体に関する統計調査: https://psboard-database.docs.cern.ch/skew_stats.html
- 結果一覧閲覧用簡易アプリケーション: https://psboard-database.docs.cern.ch/notebooks/get_results.html
- skewに関する統計調査: https://psboard-database.docs.cern.ch/notebooks/skew_stats.html
- power試験に関する統計: https://psboard-database.docs.cern.ch/notebooks/power_stats.html
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.5"
julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "7a44705ce6faa370eeecb49dce927460b0d7fd20"
project_hash = "0c756de6376fd167a1756a34f8c071b8d2746ea3"
[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
......@@ -16,19 +16,26 @@ version = "0.4.5"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
version = "1.1.2"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
[[deps.AutoHashEquals]]
git-tree-sha1 = "4ec6b48702dacc5994a835c1189831755e4e76ef"
uuid = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
version = "2.2.0"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.CSV]]
deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"]
git-tree-sha1 = "6c834533dc1fabd820c1db03c839bf97e45a3fab"
git-tree-sha1 = "deddd8725e5e1cc49ee205a1964256043720a6c3"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.10.14"
version = "0.10.15"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
......@@ -86,6 +93,7 @@ version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
version = "1.11.0"
[[deps.DocInventories]]
deps = ["CodecZlib", "Downloads", "TOML"]
......@@ -141,10 +149,12 @@ weakdeps = ["Mmap", "Test"]
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
version = "1.11.0"
[[deps.Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
version = "1.11.0"
[[deps.Git]]
deps = ["Git_jll"]
......@@ -180,6 +190,7 @@ version = "1.4.2"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
version = "1.11.0"
[[deps.InvertedIndices]]
git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038"
......@@ -193,9 +204,9 @@ version = "1.0.0"
[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "f389674c99bfcde17dc57454011aa44d5a260a40"
git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.6.0"
version = "1.6.1"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
......@@ -204,9 +215,9 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.4"
[[deps.LaTeXStrings]]
git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.1"
version = "1.4.0"
[[deps.LazilyInitializedFields]]
git-tree-sha1 = "8f7f3cabab0fd1800699663533b6d5cb3fc0e612"
......@@ -221,16 +232,17 @@ version = "0.6.4"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "8.4.0+0"
version = "8.6.0+0"
[[deps.LibGit2]]
deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
version = "1.11.0"
[[deps.LibGit2_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
version = "1.6.4+0"
version = "1.7.2+0"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
......@@ -239,23 +251,27 @@ version = "1.11.0+1"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
version = "1.11.0"
[[deps.Libiconv_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175"
git-tree-sha1 = "61dfdba58e585066d8bce214c5a51eaa0539f269"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.17.0+0"
version = "1.17.0+1"
[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
version = "1.11.0"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
version = "1.11.0"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
version = "1.11.0"
[[deps.MarkdownAST]]
deps = ["AbstractTrees", "Markdown"]
......@@ -266,7 +282,7 @@ version = "0.1.2"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+1"
version = "2.28.6+0"
[[deps.Missings]]
deps = ["DataAPI"]
......@@ -276,10 +292,11 @@ version = "1.2.0"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
version = "1.11.0"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.1.10"
version = "2023.12.12"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
......@@ -288,7 +305,7 @@ version = "1.2.0"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.23+4"
version = "0.3.27+1"
[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
......@@ -307,10 +324,10 @@ uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
version = "10.42.0+1"
[[deps.PSBoardDataBase]]
deps = ["CSV", "DBInterface", "DataFrames", "Dates", "Documenter", "Downloads", "SQLite", "Tables"]
deps = ["AutoHashEquals", "CSV", "DBInterface", "DataFrames", "Dates", "Documenter", "Downloads", "Printf", "SQLite", "StaticArrays", "Tables"]
path = "/home/qwjyh/Documents/school/lab/PSBoard_QAQC/PSBoardDataBase"
uuid = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
version = "0.1.0"
version = "0.2.0"
weakdeps = ["InteractiveUtils"]
[deps.PSBoardDataBase.extensions]
......@@ -323,9 +340,13 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.8.1"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.10.0"
version = "1.11.0"
weakdeps = ["REPL"]
[deps.Pkg.extensions]
REPLExt = "REPL"
[[deps.PooledArrays]]
deps = ["DataAPI", "Future"]
......@@ -354,14 +375,17 @@ version = "2.4.0"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
version = "1.11.0"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
version = "1.11.0"
[[deps.Random]]
deps = ["SHA"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
version = "1.11.0"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
......@@ -392,15 +416,17 @@ version = "3.45.3+0"
[[deps.SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "ff11acffdb082493657550959d4feb4b6149e73a"
git-tree-sha1 = "305becf8af67eae1dbc912ee9097f00aeeabb8d5"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.4.5"
version = "1.4.6"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
version = "1.11.0"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
version = "1.11.0"
[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
......@@ -408,15 +434,36 @@ git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.2.1"
[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
version = "1.10.0"
[[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
git-tree-sha1 = "777657803913ffc7e8cc20f0fd04b634f871af8f"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.8"
[deps.StaticArrays.extensions]
StaticArraysChainRulesCoreExt = "ChainRulesCore"
StaticArraysStatisticsExt = "Statistics"
[deps.StaticArrays.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[deps.StaticArraysCore]]
git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682"
uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
version = "1.4.3"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
deps = ["LinearAlgebra"]
git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0"
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
version = "1.10.0"
version = "1.11.1"
[deps.Statistics.extensions]
SparseArraysExt = ["SparseArrays"]
[deps.Statistics.weakdeps]
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.StringManipulation]]
deps = ["PrecompileTools"]
......@@ -424,10 +471,9 @@ git-tree-sha1 = "a6b1675a536c5ad1a60e5a5153e1fee12eb146e3"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.4.0"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.2.1+1"
[[deps.StyledStrings]]
uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
version = "1.11.0"
[[deps.TOML]]
deps = ["Dates"]
......@@ -454,18 +500,21 @@ version = "1.10.0"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
version = "1.11.0"
[[deps.TranscodingStreams]]
git-tree-sha1 = "e84b3a11b9bece70d14cce63406bbc79ed3464d2"
git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.11.2"
version = "0.11.3"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
version = "1.11.0"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
version = "1.11.0"
[[deps.WeakRefStrings]]
deps = ["DataAPI", "InlineStrings", "Parsers"]
......@@ -491,7 +540,7 @@ version = "5.11.0+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.52.0+1"
version = "1.59.0+0"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
......
......@@ -5,3 +5,6 @@ DocInventories = "43dc2714-ed3b-44b5-b226-857eda1aa7de"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
PSBoardDataBase = "779f6a9c-59fa-41f1-8ed1-e9a91eccb2f5"
[compat]
Documenter = "1.7"
......@@ -23,7 +23,16 @@ makedocs(
assets = String[],
),
repo = Remotes.GitLab("gitlab.cern.ch", "wotsubo", "PSBoardDataBase"),
pages = ["Home" => "index.md", "About this software" => "about_software.md"],
pages = [
"Home" => "index.md",
"Tutorial" => "tutorial.md",
"Apps" => [
"Simple result viewer" => "howtouse-simpleviewer.md",
"Dispatch checker" => "howtouse-dispatchchecker.md",
],
"Examples" => "examples.md",
"About this software" => "about_software.md",
],
plugins = [links],
)
......
......@@ -136,6 +136,15 @@ Modules = [DownloadCSVs]
Modules = [ClockParser]
```
## `SlaveLogParser`
部分的な実装。
そして活用も部分的。
```@autodocs
Modules = [SlaveLogParser]
```
## `DispatchChecker`
```@autodocs
......
docs/src/assets/browsing_a_table.png

212 KiB

docs/src/assets/browsing_sql_exec.png

277 KiB

docs/src/assets/browsing_tables.png

117 KiB

docs/src/assets/dispatch_checker_example.png

106 KiB

Source diff could not be displayed: it is too large. Options to address this: view the blob.
docs/src/assets/simple_result_viewer_front.png

115 KiB

!!! info
このページにはデータベースを操作する例をいくつか載せています。
!!! note
READMEや`examples`ディレクトリに具体的にデータベースを使った例が載っています。
```@contents
Pages = ["examples.md"]
Depth = 4
```
## 例
### 本番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;`をすれば結果が見れる。
### 特定のrunでテストしたPSBoard IDをすべて表示
90以上93以下のrunidで試験したPSBoardのIDをrunidとpsboard_idの昇順で表示する。
出力はCSVで行う。
```fish
$ bat src/sql/get_psbids_for_run.sql
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: src/sql/get_psbids_for_run.sql
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ WITH
2 │ single AS (
3 │ SELECT
4 │ qaqc_single_run_results.psboard_id,
5 │ qaqc_single_run_results.runid
6 │ FROM
7 │ qaqc_single_run_results
8 │ UNION
9 │ SELECT
10 │ qaqc_extra_run_results.psboard_id,
11 │ qaqc_extra_run_results.runid
12 │ FROM
13 │ qaqc_extra_run_results
14 │ )
15 │ SELECT *
16 │ FROM single
17 │ WHERE single.runid BETWEEN 90 AND 93
18 │ ORDER BY runid, psboard_id
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
$ sqlite3 psboard_qaqc.db < (echo ".headers on
.mode csv
.once test.csv
.read src/sql/get_psbids_for_run.sql" | psub)
$ cat test.csv
psboard_id,runid
44,90
62,90
74,90
103,90
127,90
132,90
137,90
149,90
160,90
164,90
196,90
204,90
270,90
280,90
305,90
322,90
335,90
356,90
44,93
62,93
74,93
103,93
127,93
132,93
137,93
149,93
160,93
164,93
196,93
204,93
270,93
280,93
305,93
322,93
335,93
356,93
```
### 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
```
パッケージの読み込み。
```julia
julia> using DataFrames, SQLite, DBInterface
```
データベースへの接続と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月以降かつ試験をパスしなかったものを表示
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
```
# 出荷チェッカーの使い方
このページではデータベースを活用した**出荷チェッカー**の使い方を説明します。
![出荷チェッカー仕様例](./assets/dispatch_checker_example.png)
## 事前準備
このアプリを使うには以下の3つが必要です。
1. julia
2. このgitリポジトリ
3. データベースファイル
### julia
[簡易試験結果閲覧アプリの使い方](./howtouse-simpleviewer.md#julia)を参照してください。
### このgitリポジトリ
このページの右上から飛べます。
### データベースファイル
[Tutorial](./tutorial.md)にかかれています。
このプロジェクト(git)のルートにおいてください。
## 実行
まずはjuliaを起動します。
ターミナルでプロジェクトのルート(`Project.toml`がある場所)に移動して以下のオプションとともに`julia`を起動してください。
```sh
$ julia --project
```
!!! tip
`-t auto`とするとマルチスレッドで起動します。
!!! tip
`using OhMyREPL`とするとREPLでシンタックスハイライトがつくようになります。
次に、パッケージを読み込みます。
```julia
using PSBoardDataBase
```
そして、[`PSBoardDataBase.DispatchChecker.interactive_dispatch_checker`](@ref)をデータベースのパスを与えて実行します。
```julia
PSBoardDataBase.DispatchChecker.interactive_dispatch_checker("psboard_qaqc.db")
```
しばらくすると`PSBoard ID: `と表示されるので、出荷チェックを行いたいPSBoardのQRコードを読むと(もしくはPS00xxxxと手入力すると)、そのPSBoardの試験結果をとってきて、**出荷可能な場合は`Ok`と表示**されます。
出荷可能でない場合は`No`と表示されます[^1]。
出荷可能かわからない場合は試験結果がすべて表示されるので、それをみて判断します(yまたはnを入れてEnter)。
[^1]: 現状表示されることはないです
最後に"Finished"のあとにPSxxxxxxがプリントされるので、それをコピーしてスプレッドシートの出荷のところに書いてください[^2]。
[^2]: もしくは返り値としてPSBoard IDの`Vector`が返ってくるのでそれを使ってください
# 簡易試験結果閲覧アプリの使い方
このページでは以下の画像のように、**あるPSBoard IDに関連する試験結果を取得する簡易的なアプリ**の使い方を説明します。
![結果閲覧アプリの起動時の様子](./assets/simple_result_viewer_front.png)
## 事前準備
このアプリを動かすには以下の3つが必要です。
1. julia
2. このgitリポジトリに含まれる`examples/get_results.jl`のファイル
3. データベースファイル
### julia
Juliaはプログラミング言語です。
[公式のダウンロードページ](https://julialang.org/downloads/)のはじめに書いてある通りにインストールするのが推奨されます。
具体的には、
- Windowsの場合
- ターミナルで`winget install julia --source msstore`(冒頭にあるコードです)
- *nixの場合
- システムのパッケージマネージャを使う(例えばAUR)、または
- 公式のダウンロードページの冒頭にあるスニペットを実行する
でダウンロードとインストールができます。
ターミナルで`julia`と打って起動すればインストール完了です。
!!! tip
```jl
using OhMyREPL
```
とするとシンタックスハイライトがつくようになって便利です。
パッケージをインストールするか聞かれるので、`y`を選びましょう。
### `examples/get_results.jl`ファイル
複数の入手方法があります。
この閲覧アプリ以外を使う予定がまったくない場合は、`./assets/get_results.html`の右上にrun this notebookみたいなのがあるので、そこからたどるとファイルをダウンロードできます。
以下で手に入れるデータベースファイルはこのファイルに対して一つ上のディレクトリに置かれることが想定されています(変更は容易です)。
**おすすめの方法**はこのgitリポジトリごとダウンロードする方法です。
`examples`ディレクトリの中に入っています。
### データベース
[Tutorial](./tutorial.md)にかかれています。
## 実行
まずは[Pluto](https://plutojl.org)をインストールします。
juliaを起動して、`]`を押して[^1]
```
add Pluto
```
と入力してパッケージをインストールします。
終わったら、BackSpaceを押して(左側が`julia>`になります)、
```julia
using Pluto
Pluto.run()
```
と入力します。
しばらくすると、ブラウザが立ち上がってPlutoが起動すると思います。
"Open a notebook"から先程入手した`get_results.jl`ファイルを選び、開きます。
右上に`Run notbook code`とあるので、クリックします。
しばらくすると(かなり時間がかかると思います。右下の"Status"が全部緑になれば完了です)[^2]、"PSBoard idを入力"と書かれたテキストボックスが使えるようになるので、そこに検索したいPSBoardのIDを入力すれば下側にそれに関連する情報が表示されます。
[^1]: Pkgモードというパッケージや環境の管理を行うモードになります。
[^2]: この間に必要なパッケージをダウンロード・コンパイルしています。2回目以降は早くなります。
## Tips
!!! tip
juliaを起動するときに`julia -t auto`とオプションをつけると、マルチスレッドで起動します。
PCの性能次第では若干処理が早くなるかもしれません。
!!! tip
ノートブック(アプリ)の下側にコードが書かれています。
中身はただのJuliaのコードなので、それらを編集すれば任意のコードが実行できます。
......@@ -7,6 +7,10 @@ Pages = ["index.md"]
Depth = 4
```
!!! info
- 簡易結果閲覧アプリの使い方は[Simple result viewer](./howtouse-simpleviewer.md)にあります。
- データベース本体の使い方に関するチュートリアルは[Tutorial](./tutorial.md)にあります。
## データベースの特徴
現時点(2024-09-13)でQAQC試験は[Google Sheetsで作成したデータベース](https://docs.google.com/spreadsheets/d/128qOseOy4QDotehYe4Wf2jj88tnwiXGVdR3NHrjcDYU/edit)でデータが管理されているが、主にデータを統合して参照するときに手作業が多く必要となり、エラーが発生する問題があった。
......@@ -44,446 +48,3 @@ Depth = 4
データベース作成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;`をすれば結果が見れる。
### 特定のrunでテストしたPSBoard IDをすべて表示
90以上93以下のrunidで試験したPSBoardのIDをrunidとpsboard_idの昇順で表示する。
出力はCSVで行う。
```fish
$ bat src/sql/get_psbids_for_run.sql
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: src/sql/get_psbids_for_run.sql
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ WITH
2 │ single AS (
3 │ SELECT
4 │ qaqc_single_run_results.psboard_id,
5 │ qaqc_single_run_results.runid
6 │ FROM
7 │ qaqc_single_run_results
8 │ UNION
9 │ SELECT
10 │ qaqc_extra_run_results.psboard_id,
11 │ qaqc_extra_run_results.runid
12 │ FROM
13 │ qaqc_extra_run_results
14 │ )
15 │ SELECT *
16 │ FROM single
17 │ WHERE single.runid BETWEEN 90 AND 93
18 │ ORDER BY runid, psboard_id
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
$ sqlite3 psboard_qaqc.db < (echo ".headers on
.mode csv
.once test.csv
.read src/sql/get_psbids_for_run.sql" | psub)
$ cat test.csv
psboard_id,runid
44,90
62,90
74,90
103,90
127,90
132,90
137,90
149,90
160,90
164,90
196,90
204,90
270,90
280,90
305,90
322,90
335,90
356,90
44,93
62,93
74,93
103,93
127,93
132,93
137,93
149,93
160,93
164,93
196,93
204,93
270,93
280,93
305,93
322,93
335,93
356,93
```
### 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
```
パッケージの読み込み。
```julia
julia> using DataFrames, SQLite, DBInterface
```
データベースへの接続と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月以降かつ試験をパスしなかったものを表示
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
```
# チュートリアル
```@contents
Pages = ["tutorial.md"]
Depth = 4
```
## データベースを手に入れる
データベースはファイルとして手に入れることができます。
QAQCキャンペーンの終了後にMattermostチャンネル上でマニュアルで配布されるものをダウンロードするか、最新のものが欲しい場合は以下の方法で手に入ります。
- このリポジトリのコードを実行する([このページ](./about_software.md)[`PSBoardDataBase.create_database_from_exported_csvs`](@ref)参照)
- QAQCをやってる部屋のPCにインストールしてあるので、それを実行する
- 知ってる人に頼む
## データベースを眺めてみる
[ここ](./index.md#アクセス方法)に列挙されているが、ここでは[DB Browser for SQLite](https://sqlitebrowser.org)で説明します。
ブラウザをインストール・起動したら、[ファイル]メニューからデータベースを開くを選びデータベースのファイルを開きます。
### テーブル
ウィンドウ左側にテーブルの一覧が表示されます。
![テーブル一覧とqaqc_runsテーブルの詳細](./assets/browsing_tables.png)
このデータベースは基本的に複数のテーブル(2次元データ)からなっています。
試しに、`qaqc_runs`という名前のテーブルをクリックすると、そのテーブルに含まれる列の情報が表示されます。
左側に列の名前、真ん中にデータ型が表示されています。
`id`の列のアイコンに黄色の鍵が描かれているが、これはこの列にはそのテーブルにおいて行を識別するための一意の値が入っていることを表します。
`campaign_id`のアイコンには灰色の鍵が描かれているが、これはこの列の要素は別のテーブルにおけるキーを参照していることを表しています。
具体的には`qaqc_campaigns`テーブルの`id`コラムのいずれかの値が入っています。
### テーブルの中身
次はこのテーブルの中身を実際に見てみよう。
テーブル名の上で右クリックすると_テーブルを閲覧_というメニューがあるので、それをクリックします。
![テーブルの中身](./assets/browsing_a_table.png)
文字通りテーブルが表示されます。
列名の書かれているすぐ下の_フィルター_というところに検索したい文字列を打ち込むことで、簡易的な検索をすることができます。
列名をクリックすることで、並べ替えもできます。
### SQL
ここまではスプレッドシートでやることと対して変わらないですが、このデータベースが真に強力なのは、[SQL](https://ja.wikipedia.org/wiki/SQL)という言語を用いてデータベースの検索(や更新)ができることです。
SQLの実行は_SQL実行_のタブから行うことができます。
まずは先ほどと同様に`qaqc_runs`のデータをすべて取ってきてみます。
上部のテキストエディタ領域に以下のSQLを書き、Ctrl+Enterを押すと実行できます。
```sql
SELECT *
FROM qaqc_runs
```
![SQLを実行する様子](./assets/browsing_sql_exec.png)
下側で取得した結果が見れます。
無事にテーブルを取得することができました。
次は複数のテーブルを組み合わせて結果を見てみましょう。
`qaqc_runs`の結果に加えて、それぞれのキャンペーンの開始と終了の日付も取得してみます。
以下のSQLを実行してみてください。
```sql
SELECT
qaqc_runs.id,
qaqc_runs.campaign_id,
qaqc_runs.run_datetime,
qaqc_campaigns.start_date,
qaqc_campaigns.end_date
FROM
qaqc_runs, qaqc_campaigns
WHERE
qaqc_runs.campaign_id = qaqc_campaigns.id
```
このSQLでは`WHERE`句を用いて制約を課しています(この制約がないと直積集合が返ってきます)。
また、特定のコラムだけを取得するようにしました。
これで各QAQC runに対して日付関連のデータを取得することができました。
### もっとSQL
SQLという言語は非常に強力です[^1]。
実はこのブラウザはGUIを用いて操作しているときも裏ではSQLを実行していました。
その履歴は、右下のタブで_SQLログ_を選択することで見れます(前の画像に載っています)[^2]。
テーブルを開いたり、フィルタをかけたりすると、SQLが次々と実行される様子を見ることができます。
[^1]: チューリング完全です。例えば[このページ](https://sqlite.org/lang_with.html)の3.5. Outlandish Recursive Query Examplesを見てみてください。
[^2]: 送信元として、"アプリケーション"を選択する必要があるかもしれません。
## 次のステップ
このままではこのデータベースを解析に組み込む方法がわからないでしょう。
次に参照すると良いであろうリンクを以下に並べます:
- [Home](./index.md)にはデータベースにアクセスする他の手段や古いですがデータベースのテーブル間の関係を表した図が載っています。
- [Examples](./examples.md)にはSQLiteとJuliaを用いてデータベースから様々な情報を取得する例が載っています。
- [power_stats.html](./assets/power_stats.html)[^3]にはデータベースを用いた解析の例が載っています。
- [skew_stats.html](./assets/skew_stats.html)はデータベースに加えて、ログやデータベース生成プログラムも直接使用したより複雑な解析を行っています。
[^3]: URL`notebooks/power_stats.html`にも同じファイルがあります。
### A Pluto.jl notebook ###
# v0.19.46
# v0.20.3
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
#! format: off
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
end
#! format: on
end
# ╔═╡ d3c95316-7ffb-11ef-1e2c-2934f89a2336
......@@ -312,9 +314,9 @@ SQLite = "~1.6.1"
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.5"
julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "f94b8dc124480c7dc21fffae2618aeb81f5d3237"
project_hash = "68b5b1b7d0691b17c298640ebab2813fd849f83c"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
......@@ -324,13 +326,15 @@ version = "1.3.2"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
version = "1.1.2"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
version = "1.11.0"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
version = "1.11.0"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
......@@ -388,6 +392,7 @@ version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
version = "1.11.0"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
......@@ -396,6 +401,7 @@ version = "1.6.0"
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
version = "1.11.0"
[[deps.FixedPointNumbers]]
deps = ["Statistics"]
......@@ -406,6 +412,7 @@ version = "0.8.5"
[[deps.Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
version = "1.11.0"
[[deps.Hyperscript]]
deps = ["Test"]
......@@ -441,6 +448,7 @@ version = "1.4.2"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
version = "1.11.0"
[[deps.InvertedIndices]]
git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038"
......@@ -454,9 +462,9 @@ version = "1.0.0"
[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "f389674c99bfcde17dc57454011aa44d5a260a40"
git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.6.0"
version = "1.6.1"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
......@@ -465,9 +473,9 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.4"
[[deps.LaTeXStrings]]
git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.1"
version = "1.4.0"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
......@@ -477,16 +485,17 @@ version = "0.6.4"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "8.4.0+0"
version = "8.6.0+0"
[[deps.LibGit2]]
deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
version = "1.11.0"
[[deps.LibGit2_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
version = "1.6.4+0"
version = "1.7.2+0"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
......@@ -495,13 +504,16 @@ version = "1.11.0+1"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
version = "1.11.0"
[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
version = "1.11.0"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
version = "1.11.0"
[[deps.MIMEs]]
git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb"
......@@ -511,11 +523,12 @@ version = "0.1.4"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
version = "1.11.0"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+1"
version = "2.28.6+0"
[[deps.Missings]]
deps = ["DataAPI"]
......@@ -525,10 +538,11 @@ version = "1.2.0"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
version = "1.11.0"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.1.10"
version = "2023.12.12"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
......@@ -537,7 +551,7 @@ version = "1.2.0"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.23+4"
version = "0.3.27+1"
[[deps.OrderedCollections]]
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
......@@ -551,9 +565,15 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.8.1"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.10.0"
version = "1.11.0"
[deps.Pkg.extensions]
REPLExt = "REPL"
[deps.Pkg.weakdeps]
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[deps.PlutoUI]]
deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"]
......@@ -588,14 +608,12 @@ version = "2.4.0"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
version = "1.11.0"
[[deps.Random]]
deps = ["SHA"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
version = "1.11.0"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
......@@ -620,15 +638,13 @@ version = "3.45.3+0"
[[deps.SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "ff11acffdb082493657550959d4feb4b6149e73a"
git-tree-sha1 = "d0553ce4031a081cc42387a9b9c8441b7d99f32d"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.4.5"
version = "1.4.7"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
version = "1.11.0"
[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
......@@ -636,15 +652,17 @@ git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.2.1"
[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
version = "1.10.0"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
deps = ["LinearAlgebra"]
git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0"
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
version = "1.10.0"
version = "1.11.1"
[deps.Statistics.extensions]
SparseArraysExt = ["SparseArrays"]
[deps.Statistics.weakdeps]
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.StringManipulation]]
deps = ["PrecompileTools"]
......@@ -652,11 +670,6 @@ git-tree-sha1 = "a6b1675a536c5ad1a60e5a5153e1fee12eb146e3"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.4.0"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.2.1+1"
[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
......@@ -682,6 +695,7 @@ version = "1.10.0"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
version = "1.11.0"
[[deps.Tricks]]
git-tree-sha1 = "7822b97e99a1672bfb1b49b668a6d46d58d8cbcb"
......@@ -696,9 +710,11 @@ version = "1.5.1"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
version = "1.11.0"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
version = "1.11.0"
[[deps.WeakRefStrings]]
deps = ["DataAPI", "InlineStrings", "Parsers"]
......@@ -719,7 +735,7 @@ version = "5.11.0+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.52.0+1"
version = "1.59.0+0"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
......