Compare commits
14 Commits
6037643a28
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d48f2b86aa | |||
| 2975dad9cd | |||
| ca227ee45f | |||
| 1ba0510a3e | |||
| 4d82b51796 | |||
| 49ddb9a238 | |||
| 7d2ae90eb3 | |||
| 90b30b0d51 | |||
| 5bb0ad8b1a | |||
| 6b12637d0a | |||
| 829436b570 | |||
| 28c9d810e9 | |||
| 9fdaf35e28 | |||
| ff2cee12ae |
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@@ -41,6 +41,24 @@
|
|||||||
},
|
},
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug executable 'groupper_report'",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"--bin=groupped_repport",
|
||||||
|
"--package=piperun-bot"
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "groupped_repport",
|
||||||
|
"kind": "bin"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"args": ["cargo", "run", "--bin=groupped_repport"],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
148
Cargo.lock
generated
148
Cargo.lock
generated
@@ -792,6 +792,12 @@ version = "0.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foldhash"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "foreign-types"
|
name = "foreign-types"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -1001,7 +1007,18 @@ checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"foldhash",
|
"foldhash 0.1.5",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.16.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
||||||
|
dependencies = [
|
||||||
|
"allocator-api2",
|
||||||
|
"equivalent",
|
||||||
|
"foldhash 0.2.0",
|
||||||
"rayon",
|
"rayon",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@@ -1311,13 +1328,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.9.0"
|
version = "2.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1890,13 +1908,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars"
|
name = "polars"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a5f7feb5d56b954e691dff22a8b2d78d77433dcc93c35fe21c3777fdc121b697"
|
checksum = "6bc9ea901050c1bb8747ee411bc7fbb390f3b399931e7484719512965132a248"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.16",
|
||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
|
"polars-compute",
|
||||||
"polars-core",
|
"polars-core",
|
||||||
"polars-error",
|
"polars-error",
|
||||||
"polars-io",
|
"polars-io",
|
||||||
@@ -1911,9 +1930,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-arrow"
|
name = "polars-arrow"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32b4fed2343961b3eea3db2cee165540c3e1ad9d5782350cc55a9e76cf440148"
|
checksum = "33d3fe43f8702cf7899ff3d516c2e5f7dc84ee6f6a3007e1a831a0ff87940704"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi_simd",
|
"atoi_simd",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@@ -1925,7 +1944,7 @@ dependencies = [
|
|||||||
"ethnum",
|
"ethnum",
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.16",
|
||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"lz4",
|
"lz4",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
@@ -1953,16 +1972,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-compute"
|
name = "polars-compute"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "138785beda4e4a90a025219f09d0d15a671b2be9091513ede58e05db6ad4413f"
|
checksum = "d29cc7497378dee3a002f117e0b4e16b7cbe6c8ed3da16a0229c89294af7c3bf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi_simd",
|
"atoi_simd",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"chrono",
|
"chrono",
|
||||||
"either",
|
"either",
|
||||||
"fast-float2",
|
"fast-float2",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
@@ -1971,7 +1990,6 @@ dependencies = [
|
|||||||
"rand",
|
"rand",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
"skiplist",
|
|
||||||
"strength_reduce",
|
"strength_reduce",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"version_check",
|
"version_check",
|
||||||
@@ -1979,9 +1997,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-core"
|
name = "polars-core"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e77b1f08ef6dbb032bb1d0d3365464be950df9905f6827a95b24c4ca5518901d"
|
checksum = "48409b7440cb1a4aa84953fe3a4189dfbfb300a3298266a92a37363476641e40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"boxcar",
|
"boxcar",
|
||||||
@@ -1990,7 +2008,7 @@ dependencies = [
|
|||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"comfy-table",
|
"comfy-table",
|
||||||
"either",
|
"either",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
@@ -2015,12 +2033,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-dtype"
|
name = "polars-dtype"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89c43d0ea57168be4546c4d8064479ed8b29a9c79c31a0c7c367ee734b9b7158"
|
checksum = "7007e9e8b7b657cbd339b65246af7e87f5756ee9a860119b9424ddffd2aaf133"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boxcar",
|
"boxcar",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
"polars-error",
|
"polars-error",
|
||||||
"polars-utils",
|
"polars-utils",
|
||||||
@@ -2030,9 +2048,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-error"
|
name = "polars-error"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9cb5d98f59f8b94673ee391840440ad9f0d2170afced95fc98aa86f895563c0"
|
checksum = "f9a6be22566c89f6405f553bfdb7c8a6cb20ec51b35f3172de9a25fa3e252d85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"object_store",
|
"object_store",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@@ -2044,12 +2062,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-expr"
|
name = "polars-expr"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "343931b818cf136349135ba11dbc18c27683b52c3477b1ba8ca606cf5ab1965c"
|
checksum = "6199a50d3e1afd0674fb009e340cbfb0010682b2387187a36328c00f3f2ca87b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
"polars-compute",
|
"polars-compute",
|
||||||
@@ -2063,13 +2081,15 @@ dependencies = [
|
|||||||
"rand",
|
"rand",
|
||||||
"rayon",
|
"rayon",
|
||||||
"recursive",
|
"recursive",
|
||||||
|
"regex",
|
||||||
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-io"
|
name = "polars-io"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10388c64b8155122488229a881d1c6f4fdc393bc988e764ab51b182fcb2307e4"
|
checksum = "be3714acdff87170141880a07f5d9233490d3bd5531c41898f6969d440feee11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"atoi_simd",
|
"atoi_simd",
|
||||||
@@ -2080,7 +2100,7 @@ dependencies = [
|
|||||||
"fs4",
|
"fs4",
|
||||||
"futures",
|
"futures",
|
||||||
"glob",
|
"glob",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"home",
|
"home",
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -2089,6 +2109,7 @@ dependencies = [
|
|||||||
"object_store",
|
"object_store",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
|
"polars-compute",
|
||||||
"polars-core",
|
"polars-core",
|
||||||
"polars-error",
|
"polars-error",
|
||||||
"polars-parquet",
|
"polars-parquet",
|
||||||
@@ -2103,15 +2124,13 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"simdutf8",
|
"simdutf8",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
|
||||||
"url",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-lazy"
|
name = "polars-lazy"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fb6e2c6c2fa4ea0c660df1c06cf56960c81e7c2683877995bae3d4e3d408147"
|
checksum = "ea136c360d03aafe56e0233495e30044ce43639b8b0360a4a38e840233f048a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -2134,9 +2153,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-mem-engine"
|
name = "polars-mem-engine"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20a856e98e253587c28d8132a5e7e5a75cb2c44731ca090f1481d45f1d123771"
|
checksum = "0f6e455ceb6e5aee7ed7d5c8944104e66992173e03a9c42f9670226318672249"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
@@ -2154,9 +2173,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-ops"
|
name = "polars-ops"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "acf6062173fdc9ba05775548beb66e76643a148d9aeadc9984ed712bc4babd76"
|
checksum = "7b59c80a019ef0e6f09b4416d2647076a52839305c9eb11919e8298ec667f853"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argminmax",
|
"argminmax",
|
||||||
"base64",
|
"base64",
|
||||||
@@ -2164,7 +2183,7 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"either",
|
"either",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"hex",
|
"hex",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"libm",
|
"libm",
|
||||||
@@ -2187,16 +2206,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-parquet"
|
name = "polars-parquet"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc1d769180dec070df0dc4b89299b364bf2cfe32b218ecc4ddd8f1a49ae60669"
|
checksum = "93c2439d127c59e6bfc9d698419bdb45210068a6f501d44e6096429ad72c2eaa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"base64",
|
"base64",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"ethnum",
|
"ethnum",
|
||||||
"futures",
|
"futures",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
"polars-compute",
|
"polars-compute",
|
||||||
@@ -2220,9 +2239,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-plan"
|
name = "polars-plan"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1cd3a2e33ae4484fe407ab2d2ba5684f0889d1ccf3ad6b844103c03638e6d0a0"
|
checksum = "65b4619f5c7e9b91f18611c9ed82ebeee4b10052160825c1316ecf4dbd4d97e6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
@@ -2230,7 +2249,7 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"either",
|
"either",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
@@ -2246,15 +2265,16 @@ dependencies = [
|
|||||||
"recursive",
|
"recursive",
|
||||||
"regex",
|
"regex",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
"slotmap",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-row"
|
name = "polars-row"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "18734f17e0e348724df3ae65f3ee744c681117c04b041cac969dfceb05edabc0"
|
checksum = "a18d232f25b83032e280a279a1f40beb8a6f8fc43907b13dc07b1c56f3b11eea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
@@ -2267,9 +2287,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-schema"
|
name = "polars-schema"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e6c1ab13e04d5167661a9854ed1ea0482b2ed9b8a0f1118dabed7cd994a85e3"
|
checksum = "f73e21d429ae1c23f442b0220ccfe773a9734a44e997b5062a741842909d9441"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"polars-error",
|
"polars-error",
|
||||||
@@ -2280,9 +2300,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-sql"
|
name = "polars-sql"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c4e7766da02cc1d464994404d3e88a7a0ccd4933df3627c325480fbd9bbc0a11"
|
checksum = "3e67ac1cbb0c972a57af3be12f19aa9803898863fe95c33cdd39df05f5738a75"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"hex",
|
"hex",
|
||||||
@@ -2301,14 +2321,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-stream"
|
name = "polars-stream"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "31f6c6ca1ea01f9dea424d167e4f33f5ec44cd67fbfac9efd40575ed20521f14"
|
checksum = "2ff19612074640a9d65e5928b7223db76ffee63e55b276f1e466d06719eb7362"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-channel",
|
"async-channel",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"atomic-waker",
|
"atomic-waker",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"chrono-tz",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
"crossbeam-queue",
|
"crossbeam-queue",
|
||||||
@@ -2319,6 +2340,7 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"polars-arrow",
|
"polars-arrow",
|
||||||
|
"polars-compute",
|
||||||
"polars-core",
|
"polars-core",
|
||||||
"polars-error",
|
"polars-error",
|
||||||
"polars-expr",
|
"polars-expr",
|
||||||
@@ -2327,21 +2349,21 @@ dependencies = [
|
|||||||
"polars-ops",
|
"polars-ops",
|
||||||
"polars-parquet",
|
"polars-parquet",
|
||||||
"polars-plan",
|
"polars-plan",
|
||||||
|
"polars-time",
|
||||||
"polars-utils",
|
"polars-utils",
|
||||||
"rand",
|
"rand",
|
||||||
"rayon",
|
"rayon",
|
||||||
"recursive",
|
"recursive",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-time"
|
name = "polars-time"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6a3a6e279a7a984a0b83715660f9e880590c6129ec2104396bfa710bcd76dee"
|
checksum = "ddce7a9f81d5f47d981bcee4a8db004f9596bb51f0f4d9d93667a1a00d88166c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi_simd",
|
"atoi_simd",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
@@ -2362,9 +2384,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polars-utils"
|
name = "polars-utils"
|
||||||
version = "0.51.0"
|
version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57b267021b0e5422d7fbc70fd79e51b9f9a8466c585779373a18b0199e973f29"
|
checksum = "667c1bc2d2313f934d711f6e3b58d8d9f80351d14ea60af936a26b7dfb06e309"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
@@ -2372,8 +2394,8 @@ dependencies = [
|
|||||||
"compact_str",
|
"compact_str",
|
||||||
"either",
|
"either",
|
||||||
"flate2",
|
"flate2",
|
||||||
"foldhash",
|
"foldhash 0.2.0",
|
||||||
"hashbrown 0.15.3",
|
"hashbrown 0.16.0",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"libc",
|
"libc",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
@@ -3030,16 +3052,6 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "skiplist"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f354fd282d3177c2951004953e2fdc4cb342fa159bbee8b829852b6a081c8ea1"
|
|
||||||
dependencies = [
|
|
||||||
"rand",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@@ -3354,8 +3366,6 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
|
||||||
"hashbrown 0.15.3",
|
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|||||||
10
Cargo.toml
10
Cargo.toml
@@ -4,8 +4,12 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "groupped_repport"
|
name = "groupped-repport-weekly"
|
||||||
path = "src/groupped_repport.rs"
|
path = "src/groupped_repport_weekly.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "groupped-repport-monthly"
|
||||||
|
path = "src/groupped_repport_monthly.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "piperun-bot"
|
name = "piperun-bot"
|
||||||
@@ -23,7 +27,7 @@ zip = { version = "6.0.0"}
|
|||||||
walkdir = { version = "2.5.0"}
|
walkdir = { version = "2.5.0"}
|
||||||
lettre = {version = "0.11.19", features = ["builder"]}
|
lettre = {version = "0.11.19", features = ["builder"]}
|
||||||
anyhow = { version = "1.0.100"}
|
anyhow = { version = "1.0.100"}
|
||||||
polars = { version = "0.51.0"}
|
polars = { version = "0.52.0"}
|
||||||
serde = { version = "1.0.228" }
|
serde = { version = "1.0.228" }
|
||||||
csv = {version = "1.4.0"}
|
csv = {version = "1.4.0"}
|
||||||
regex = { version = "1.12.2" }
|
regex = { version = "1.12.2" }
|
||||||
@@ -22,7 +22,7 @@ NÃO ESTÁ ERRADO SE O AGENTE UTILIZAR 'TU', 'TEU', 'TUA'. SOMOS UMA EMPRESA REG
|
|||||||
"DE FORMA REMOTA EU IDENTIFIQUEI QUE O EQUIPAMENTO DA FIBRA NÃO ESTÁ RECEBENDO ENERGIA"
|
"DE FORMA REMOTA EU IDENTIFIQUEI QUE O EQUIPAMENTO DA FIBRA NÃO ESTÁ RECEBENDO ENERGIA"
|
||||||
"ATÉ TUA ANTENA ESTA TUDO CERTO, O SINAL QUE CHEGA ATÉ ELA É BOM, ESTÁ DENTRO DO PADRÃO"
|
"ATÉ TUA ANTENA ESTA TUDO CERTO, O SINAL QUE CHEGA ATÉ ELA É BOM, ESTÁ DENTRO DO PADRÃO"
|
||||||
|
|
||||||
09 (DIDATISMO) - O AGENTE DEVE SER DIDÁTICO, EXPLICANDO O MOTIVO DE CADA SOLICITAÇÃO OU VERIFICAÇÃO.
|
09 (DIDATISMO) – O AGENTE DEVE SER DIDÁTICO, EXPLICANDO O MOTIVO DE CADA SOLICITAÇÃO OU VERIFICAÇÃO.
|
||||||
A EXPLICAÇÃO PODE VIR ANTES OU DEPOIS DA SOLICITAÇÃO.
|
A EXPLICAÇÃO PODE VIR ANTES OU DEPOIS DA SOLICITAÇÃO.
|
||||||
NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR CLARO O PORQUÊ.
|
NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR CLARO O PORQUÊ.
|
||||||
✅ EXEMPLOS CORRETOS:
|
✅ EXEMPLOS CORRETOS:
|
||||||
@@ -39,7 +39,10 @@ NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR CLARO O P
|
|||||||
❌ NÃO CONSIDERAR DIDÁTICO:
|
❌ NÃO CONSIDERAR DIDÁTICO:
|
||||||
QUANDO O AGENTE PEDE ALGO SEM DIZER O MOTIVO.
|
QUANDO O AGENTE PEDE ALGO SEM DIZER O MOTIVO.
|
||||||
FRASES VAGAS COMO: "RECOLOQUE OS CABOS", "DESLIGA E LIGA DE NOVO", "PODE VERIFICAR SE VOLTOU?"
|
FRASES VAGAS COMO: "RECOLOQUE OS CABOS", "DESLIGA E LIGA DE NOVO", "PODE VERIFICAR SE VOLTOU?"
|
||||||
|
NÃO CONSIDERAR A SOLICITAÇÃO DE E-MAIL COMO ALGO DIDATICO.
|
||||||
NÃO CONSIDERAR A CONFIRMAÇÃO DE E-MAIL COMO ALGO DIDATICO.
|
NÃO CONSIDERAR A CONFIRMAÇÃO DE E-MAIL COMO ALGO DIDATICO.
|
||||||
|
NÃO CONSIDERAR A SOLICITAÇÃO DE TELEFONE COMO ALGO DIDATICO.
|
||||||
|
NÃO CONSIDERAR A CONFIRMAÇÃO DE TELEFONE COMO ALGO DIDATICO.
|
||||||
|
|
||||||
10 (ECLARECIMENTO) - DURANTE A CONVERSA, O AGENTE DEVE FECHAR UM DIAGNOSTICO.
|
10 (ECLARECIMENTO) - DURANTE A CONVERSA, O AGENTE DEVE FECHAR UM DIAGNOSTICO.
|
||||||
NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR O CLIENTE CIENTE DA CONCLUSÃO DO ATENDIMENTO.
|
NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR O CLIENTE CIENTE DA CONCLUSÃO DO ATENDIMENTO.
|
||||||
@@ -51,9 +54,6 @@ NÃO É NECESSÁRIO USAR AS MESMAS PALAVRAS DOS EXEMPLOS, BASTA DEIXAR O CLIENTE
|
|||||||
"SE A CONEXÃO ESTÁ SENDO USADA POR MUITAS PESSOAS AO MESMO TEMPO E ISSO FAZER COM QUE O CONSUMO SUPERE A VELOCIDADE CONTRATADA, A CONEXÃO PODERÁ APRESENTAR LENTIDÃO"
|
"SE A CONEXÃO ESTÁ SENDO USADA POR MUITAS PESSOAS AO MESMO TEMPO E ISSO FAZER COM QUE O CONSUMO SUPERE A VELOCIDADE CONTRATADA, A CONEXÃO PODERÁ APRESENTAR LENTIDÃO"
|
||||||
"EM ESPECÍFICO, QUANDO SE TRATA DE DISPOSITIVOS BOX, RECEPTORES DE CANAIS E APLICATIVOS IPTV, INFELIZMENTE NÃO CONSEGUIMOS GARANTIR ESTABILIDADE PARA ESSES TIPOS DE SERVIÇOS, JÁ QUE ELES NÃO DEPENDEM APENAS DE UMA BOA QUALIDADE DE INTERNET PARA FUNCIONAR CORRETAMENTE. VOU TE INDICAR A VERIFICAR A RESPEITO COM A PESSOA QUE TE FORNECEU O SERVIÇO, SE POSSÍVEL"
|
"EM ESPECÍFICO, QUANDO SE TRATA DE DISPOSITIVOS BOX, RECEPTORES DE CANAIS E APLICATIVOS IPTV, INFELIZMENTE NÃO CONSEGUIMOS GARANTIR ESTABILIDADE PARA ESSES TIPOS DE SERVIÇOS, JÁ QUE ELES NÃO DEPENDEM APENAS DE UMA BOA QUALIDADE DE INTERNET PARA FUNCIONAR CORRETAMENTE. VOU TE INDICAR A VERIFICAR A RESPEITO COM A PESSOA QUE TE FORNECEU O SERVIÇO, SE POSSÍVEL"
|
||||||
"O IDEAL SERIA CONECTAR TUA TV AO ROTEADOR POR UM CABO DE REDE, POIS ASSIM, O SINAL SERÁ TRANSMITIDO DIRETO, SEM SOFRER INTERFERÊNCIA.
|
"O IDEAL SERIA CONECTAR TUA TV AO ROTEADOR POR UM CABO DE REDE, POIS ASSIM, O SINAL SERÁ TRANSMITIDO DIRETO, SEM SOFRER INTERFERÊNCIA.
|
||||||
|
|
||||||
11 (TEMPO DE ESPERA) - O AGENTE NÃO PODE DEIXAR O CLIENTE SEM RETORNO POR MAIS DE 5 MINUTOS EM 3 OU MAIS MOMENTOS DIFERENTES.
|
|
||||||
AO ANALISAR, CONSIDERE SEMPRE O TEMPO ENTRE A ÚLTIMA MENSAGEM ENVIADA PELO CLIENTE E A PRÓXIMA MENSAGEM ENVIADA PELO AGENTE.
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
As mensagens do chat estão estruturadas no formato JSON com os campos:
|
As mensagens do chat estão estruturadas no formato JSON com os campos:
|
||||||
|
|||||||
386
src/groupped_repport_monthly.rs
Normal file
386
src/groupped_repport_monthly.rs
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use chrono::{Datelike, NaiveDate};
|
||||||
|
use itertools::Itertools;
|
||||||
|
use polars::prelude::*;
|
||||||
|
use reqwest;
|
||||||
|
use std::env;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use csv;
|
||||||
|
|
||||||
|
pub mod send_mail_util;
|
||||||
|
pub mod zip_directory_util;
|
||||||
|
|
||||||
|
#[derive(Debug, serde::Deserialize)]
|
||||||
|
struct CsvHeader {
|
||||||
|
CATEGORIA: String,
|
||||||
|
PONTOS: Option<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, serde::Deserialize)]
|
||||||
|
struct CsvEvaluation {
|
||||||
|
APRESENTAÇÃO: u8,
|
||||||
|
CONFIRMAÇÃO_DE_EMAIL: u8,
|
||||||
|
CONFIRMAÇÃO_DE_TELEFONE: u8,
|
||||||
|
PROTOCOLO: u8,
|
||||||
|
USO_DO_PORTUGUÊS: u8,
|
||||||
|
PACIÊNCIA_E_EDUCAÇÃO: u8,
|
||||||
|
DISPONIBILIDADE: u8,
|
||||||
|
CONHECIMENTO_TÉCNICO: u8,
|
||||||
|
DIDATISMO: u8,
|
||||||
|
ID_TALK: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match dotenv::dotenv().ok() {
|
||||||
|
Some(_) => println!("Environment variables loaded from .env file"),
|
||||||
|
None => eprintln!("Failed to load .env file, using defaults"),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read environment variables
|
||||||
|
let OLLAMA_URL = env::var("OLLAMA_URL").unwrap_or("localhost".to_string());
|
||||||
|
let OLLAMA_PORT = env::var("OLLAMA_PORT")
|
||||||
|
.unwrap_or("11432".to_string())
|
||||||
|
.parse::<u16>()
|
||||||
|
.unwrap_or(11432);
|
||||||
|
let OLLAMA_AI_MODEL_DATA_SANITIZATION = env::var("OLLAMA_AI_MODEL_DATA_SANITIZATION")
|
||||||
|
.expect("Missing environment variable OLLAMA_AI_MODEL_DATA_SANITIZATION");
|
||||||
|
let BOT_EMAIL = env::var("BOT_EMAIL").expect("BOT_EMAIL has not been set!");
|
||||||
|
let BOT_EMAIL_PASSWORD =
|
||||||
|
env::var("BOT_EMAIL_PASSWORD").expect("BOT_EMAIL_PASSWORD has not been set!");
|
||||||
|
|
||||||
|
let ip_address = ipaddress::IPAddress::parse(OLLAMA_URL.to_string());
|
||||||
|
let OLLAMA_SANITIZED_IP = match ip_address {
|
||||||
|
Ok(ip) => {
|
||||||
|
if ip.is_ipv4() {
|
||||||
|
OLLAMA_URL.clone()
|
||||||
|
} else {
|
||||||
|
format!("[{}]", OLLAMA_URL.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => OLLAMA_URL.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get the current day in the format YYYY-MM-DD
|
||||||
|
let current_date = chrono::Local::now();
|
||||||
|
let formatted_date = current_date.format("%Y-%m-%d").to_string();
|
||||||
|
|
||||||
|
let current_date = chrono::Local::now();
|
||||||
|
// let first_day_of_current_month = NaiveDate::fro
|
||||||
|
|
||||||
|
let current_day_of_last_month = current_date
|
||||||
|
.checked_sub_months(chrono::Months::new(1))
|
||||||
|
.expect("Failed to subtract one month");
|
||||||
|
|
||||||
|
let first_day_of_last_month = NaiveDate::from_ymd_opt(
|
||||||
|
current_day_of_last_month.year(),
|
||||||
|
current_day_of_last_month.month(),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
.expect("Failed to obtain date");
|
||||||
|
let last_day_of_last_month = NaiveDate::from_ymd_opt(
|
||||||
|
current_day_of_last_month.year(),
|
||||||
|
current_day_of_last_month.month(),
|
||||||
|
current_day_of_last_month.num_days_in_month() as u32,
|
||||||
|
)
|
||||||
|
.expect("Failed to obtain date");
|
||||||
|
|
||||||
|
let previous_month_folder_names = std::fs::read_dir(std::path::Path::new("./evaluations"))
|
||||||
|
.expect("Failed to read directory ./evaluations")
|
||||||
|
.filter_map_ok(|entry| {
|
||||||
|
if entry.metadata().unwrap().is_dir() {
|
||||||
|
Some(entry.file_name())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter_map_ok(|entry_string_name| {
|
||||||
|
let regex_match_date =
|
||||||
|
regex::Regex::new(r"(\d{4}-\d{2}-\d{2})").expect("Failed to build regex");
|
||||||
|
|
||||||
|
let filename = entry_string_name.to_str().unwrap();
|
||||||
|
let matches_find = regex_match_date.find(filename);
|
||||||
|
|
||||||
|
match matches_find {
|
||||||
|
Some(found) => {
|
||||||
|
let date = chrono::NaiveDate::parse_from_str(found.as_str(), "%Y-%m-%d");
|
||||||
|
return Some((date.unwrap(), entry_string_name));
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter_map_ok(|(folder_name_date, directory_string)| {
|
||||||
|
if folder_name_date.year() == first_day_of_last_month.year()
|
||||||
|
&& folder_name_date.month() == first_day_of_last_month.month()
|
||||||
|
{
|
||||||
|
return Some(directory_string);
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
})
|
||||||
|
.filter_map(|value| {
|
||||||
|
if value.is_ok() {
|
||||||
|
return Some(value.unwrap());
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sorted()
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
println!("{:?}", previous_month_folder_names);
|
||||||
|
|
||||||
|
let prompt_data_sanitization = std::fs::read_to_string("./PROMPT_DATA_SANITIZATION.txt")
|
||||||
|
.expect("Failed to read PROMPT_DATA_SANITIZATION.txt");
|
||||||
|
let client = reqwest::blocking::Client::new();
|
||||||
|
|
||||||
|
let groupped_values = previous_month_folder_names
|
||||||
|
.iter()
|
||||||
|
.map(|folder_name| {
|
||||||
|
let folder_base_path = std::path::Path::new("./evaluations");
|
||||||
|
let folder_date_path = folder_base_path.join(folder_name);
|
||||||
|
std::fs::read_dir(folder_date_path)
|
||||||
|
})
|
||||||
|
.filter_map_ok(|files_inside_folder_on_date| {
|
||||||
|
let groupped_by_user_on_day = files_inside_folder_on_date
|
||||||
|
.filter_ok(|entry| {
|
||||||
|
let entry_file_name_as_str = entry
|
||||||
|
.file_name()
|
||||||
|
.into_string()
|
||||||
|
.expect("Failed to get filename as a String");
|
||||||
|
|
||||||
|
entry_file_name_as_str.ends_with(".csv")
|
||||||
|
&& !entry_file_name_as_str.contains("response_time.csv")
|
||||||
|
})
|
||||||
|
.filter_map(|value| {
|
||||||
|
if value.is_ok() {
|
||||||
|
return Some(value.unwrap());
|
||||||
|
}
|
||||||
|
None
|
||||||
|
})
|
||||||
|
.map(|file_name_csv| {
|
||||||
|
println!("{:?}", file_name_csv.path());
|
||||||
|
let file_contents = std::fs::read_to_string(file_name_csv.path())
|
||||||
|
.expect("Failed to read CSV file");
|
||||||
|
|
||||||
|
let ollama_api_request = client
|
||||||
|
.post(format!(
|
||||||
|
"http://{OLLAMA_SANITIZED_IP}:{OLLAMA_PORT}/api/generate"
|
||||||
|
))
|
||||||
|
.body(
|
||||||
|
serde_json::json!({
|
||||||
|
"model": OLLAMA_AI_MODEL_DATA_SANITIZATION,
|
||||||
|
"prompt": format!("{prompt_data_sanitization} \n{file_contents}"),
|
||||||
|
"temperature": 0.0, // Get predictable and reproducible output
|
||||||
|
"stream": false,
|
||||||
|
})
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let result = ollama_api_request.timeout(Duration::from_secs(3600)).send();
|
||||||
|
|
||||||
|
match result {
|
||||||
|
Ok(response) => {
|
||||||
|
println!("Response: {:?}", response);
|
||||||
|
let response_json = response
|
||||||
|
.json::<serde_json::Value>()
|
||||||
|
.expect("Failed to deserialize response to JSON");
|
||||||
|
let ai_response = response_json["response"]
|
||||||
|
.as_str()
|
||||||
|
.expect("Failed to get AI response as string");
|
||||||
|
|
||||||
|
let ai_response = ai_response.to_string();
|
||||||
|
|
||||||
|
let ai_response = if let Some(resp) = ai_response
|
||||||
|
.strip_prefix(" ")
|
||||||
|
.unwrap_or(&ai_response)
|
||||||
|
.strip_prefix("```csv\n")
|
||||||
|
{
|
||||||
|
resp.to_string()
|
||||||
|
} else {
|
||||||
|
ai_response
|
||||||
|
};
|
||||||
|
let ai_response = if let Some(resp) = ai_response
|
||||||
|
.strip_suffix(" ")
|
||||||
|
.unwrap_or(&ai_response)
|
||||||
|
.strip_suffix("```")
|
||||||
|
{
|
||||||
|
resp.to_string()
|
||||||
|
} else {
|
||||||
|
ai_response
|
||||||
|
};
|
||||||
|
|
||||||
|
return Ok((ai_response, file_name_csv));
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
println!("Error {error}");
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter_map_ok(|(ai_repsonse, file_path_csv)| {
|
||||||
|
let mut reader = csv::ReaderBuilder::new()
|
||||||
|
.has_headers(true)
|
||||||
|
.delimiter(b';')
|
||||||
|
.from_reader(ai_repsonse.as_bytes());
|
||||||
|
|
||||||
|
let mut deserialized_iter = reader.deserialize::<CsvHeader>();
|
||||||
|
|
||||||
|
let mut columns = deserialized_iter
|
||||||
|
.filter_ok(|value| value.PONTOS.is_some())
|
||||||
|
.map_ok(|value| {
|
||||||
|
let col =
|
||||||
|
Column::new(value.CATEGORIA.into(), [value.PONTOS.unwrap() as u32]);
|
||||||
|
col
|
||||||
|
})
|
||||||
|
.filter_map(|value| {
|
||||||
|
if value.is_ok() {
|
||||||
|
return Some(value.unwrap());
|
||||||
|
}
|
||||||
|
None
|
||||||
|
})
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
if columns.len() != 9 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse id talk from file_path
|
||||||
|
// filename example is: CC - Erraoander Quintana - 515578 - 20251020515578.csv
|
||||||
|
// id talk is the last information, so in the example is: 20251020515578
|
||||||
|
let regex_filename =
|
||||||
|
regex::Regex::new(r"(CC - )((\w+\s*)+) - (\d+) - (\d+).csv").unwrap();
|
||||||
|
|
||||||
|
let filename = file_path_csv
|
||||||
|
.file_name()
|
||||||
|
.into_string()
|
||||||
|
.expect("Failed to convert file name as Rust &str");
|
||||||
|
let found_regex_groups_in_filename = regex_filename
|
||||||
|
.captures(filename.as_str())
|
||||||
|
.expect("Failed to do regex capture");
|
||||||
|
|
||||||
|
let user_name = found_regex_groups_in_filename
|
||||||
|
.get(2)
|
||||||
|
.expect("Failed to get the id from regex maches");
|
||||||
|
let talk_id = found_regex_groups_in_filename
|
||||||
|
.get(5)
|
||||||
|
.expect("Failed to get the id from regex maches");
|
||||||
|
|
||||||
|
let excelence_percentual = columns
|
||||||
|
.iter()
|
||||||
|
.map(|col| col.as_materialized_series().u32().unwrap().sum().unwrap())
|
||||||
|
.sum::<u32>() as f32
|
||||||
|
/ columns.iter().len() as f32
|
||||||
|
* 100.0;
|
||||||
|
columns.push(Column::new(
|
||||||
|
"PERCENTUAL DE EXELENCIA".into(),
|
||||||
|
[format!("{excelence_percentual:.2}")],
|
||||||
|
));
|
||||||
|
|
||||||
|
columns.push(Column::new("ID_TALK".into(), [talk_id.clone().as_str()]));
|
||||||
|
|
||||||
|
let df = polars::frame::DataFrame::new(columns)
|
||||||
|
.expect("Failed to concatenate into a dataframe");
|
||||||
|
|
||||||
|
// return a tuple with the dataframe and the user name, so it can be correctly merged after
|
||||||
|
return Some((user_name.as_str().to_owned(), df));
|
||||||
|
})
|
||||||
|
.filter_map(|res| {
|
||||||
|
if res.is_ok() {
|
||||||
|
return Some(res.unwrap());
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
})
|
||||||
|
.into_group_map()
|
||||||
|
.into_iter()
|
||||||
|
.map(|(name, eval_dataframe_vec)| {
|
||||||
|
let groupped_df = eval_dataframe_vec
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.reduce(|acc, e| acc.vstack(&e).unwrap())
|
||||||
|
.expect("Failed to concatenate dataframes");
|
||||||
|
(name, groupped_df)
|
||||||
|
})
|
||||||
|
.into_group_map();
|
||||||
|
|
||||||
|
dbg!(&groupped_by_user_on_day);
|
||||||
|
return Some(groupped_by_user_on_day);
|
||||||
|
})
|
||||||
|
.filter_map(|res| {
|
||||||
|
if res.is_ok() {
|
||||||
|
return Some(res.unwrap());
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
})
|
||||||
|
.reduce(|mut acc, mut e| {
|
||||||
|
e.iter_mut().for_each(|(key, val)| {
|
||||||
|
if acc.contains_key(key) {
|
||||||
|
acc.get_mut(key)
|
||||||
|
.expect("Failed to obtain key that should already be present")
|
||||||
|
.append(val);
|
||||||
|
} else {
|
||||||
|
acc.insert(key.to_owned(), val.to_owned());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
acc
|
||||||
|
})
|
||||||
|
.and_then(|groupped_hashmap_df| {
|
||||||
|
let result = groupped_hashmap_df
|
||||||
|
.iter()
|
||||||
|
.map(|(key, val)| {
|
||||||
|
let dfs = val
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.reduce(|acc, e| acc.vstack(&e).unwrap())
|
||||||
|
.expect("Failed to concatenate dataframes");
|
||||||
|
(key.clone(), dfs)
|
||||||
|
})
|
||||||
|
.collect_vec();
|
||||||
|
return Some(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Setup groupped folder
|
||||||
|
if !std::fs::exists(format!("./groupped/")).unwrap() {
|
||||||
|
std::fs::create_dir(format!("./groupped")).expect("Failed to create directory")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup previous week folder
|
||||||
|
if !std::fs::exists(format!("./groupped/{first_day_of_last_month}")).unwrap() {
|
||||||
|
std::fs::create_dir(format!("./groupped/{first_day_of_last_month}"))
|
||||||
|
.expect("Failed to create directory")
|
||||||
|
}
|
||||||
|
|
||||||
|
match groupped_values {
|
||||||
|
Some(mut val) => {
|
||||||
|
val.iter_mut().for_each(|(agent, groupped_evaluations)| {
|
||||||
|
let mut save_file_csv = std::fs::File::create(format!(
|
||||||
|
"./groupped/{first_day_of_last_month}/{agent}.csv"
|
||||||
|
))
|
||||||
|
.expect("Could not create csv file for saving");
|
||||||
|
CsvWriter::new(&mut save_file_csv)
|
||||||
|
.include_header(true)
|
||||||
|
.with_separator(b';')
|
||||||
|
.finish(groupped_evaluations)
|
||||||
|
.expect("Failed to save Groupped DataFrame to CSV File");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
zip_directory_util::zip_directory_util::zip_source_dir_to_dst_file(
|
||||||
|
std::path::Path::new(&format!("./groupped/{first_day_of_last_month}")),
|
||||||
|
std::path::Path::new(&format!("./groupped/{first_day_of_last_month}.zip")),
|
||||||
|
);
|
||||||
|
|
||||||
|
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
||||||
|
println!("Trying to send mail... {recipients}");
|
||||||
|
send_mail_util::send_mail_util::send_email(
|
||||||
|
&format!("Relatório agrupado dos atendimentos do mês {first_day_of_last_month}"),
|
||||||
|
&BOT_EMAIL,
|
||||||
|
&BOT_EMAIL_PASSWORD,
|
||||||
|
recipients,
|
||||||
|
&format!("./groupped/{first_day_of_last_month}.zip"),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -262,6 +262,17 @@ fn main() {
|
|||||||
.get(5)
|
.get(5)
|
||||||
.expect("Failed to get the id from regex maches");
|
.expect("Failed to get the id from regex maches");
|
||||||
|
|
||||||
|
let excelence_percentual = columns
|
||||||
|
.iter()
|
||||||
|
.map(|col| col.as_materialized_series().u32().unwrap().sum().unwrap())
|
||||||
|
.sum::<u32>() as f32
|
||||||
|
/ columns.iter().len() as f32
|
||||||
|
* 100.0;
|
||||||
|
columns.push(Column::new(
|
||||||
|
"PERCENTUAL DE EXELENCIA".into(),
|
||||||
|
[format!("{excelence_percentual:.2}")],
|
||||||
|
));
|
||||||
|
|
||||||
columns.push(Column::new("ID_TALK".into(), [talk_id.clone().as_str()]));
|
columns.push(Column::new("ID_TALK".into(), [talk_id.clone().as_str()]));
|
||||||
|
|
||||||
let df = polars::frame::DataFrame::new(columns)
|
let df = polars::frame::DataFrame::new(columns)
|
||||||
@@ -345,7 +356,7 @@ fn main() {
|
|||||||
Some(mut val) => {
|
Some(mut val) => {
|
||||||
val.iter_mut().for_each(|(agent, groupped_evaluations)| {
|
val.iter_mut().for_each(|(agent, groupped_evaluations)| {
|
||||||
let mut save_file_csv = std::fs::File::create(format!(
|
let mut save_file_csv = std::fs::File::create(format!(
|
||||||
"./groupped/{first_day_of_last_week} - {last_day_of_last_week}/{agent}"
|
"./groupped/{first_day_of_last_week} - {last_day_of_last_week}/{agent}.csv"
|
||||||
))
|
))
|
||||||
.expect("Could not create csv file for saving");
|
.expect("Could not create csv file for saving");
|
||||||
CsvWriter::new(&mut save_file_csv)
|
CsvWriter::new(&mut save_file_csv)
|
||||||
@@ -368,6 +379,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
||||||
|
println!("Trying to send mail... {recipients}");
|
||||||
send_mail_util::send_mail_util::send_email(
|
send_mail_util::send_mail_util::send_email(
|
||||||
&format!(
|
&format!(
|
||||||
"Relatório agrupado dos atendimentos semana {first_day_of_last_week} - {last_day_of_last_week}"
|
"Relatório agrupado dos atendimentos semana {first_day_of_last_week} - {last_day_of_last_week}"
|
||||||
145
src/main.rs
145
src/main.rs
@@ -1,15 +1,17 @@
|
|||||||
use std::ffi::OsStr;
|
|
||||||
use std::{any::Any, env, fmt::format, iter, time::Duration};
|
use std::{any::Any, env, fmt::format, iter, time::Duration};
|
||||||
|
|
||||||
use chrono::{self, Timelike};
|
use chrono::{self, Timelike};
|
||||||
use dotenv;
|
use dotenv;
|
||||||
use ipaddress;
|
use ipaddress;
|
||||||
use itertools::{self, Itertools};
|
use itertools::{self, Itertools};
|
||||||
use lettre::message::Mailboxes;
|
|
||||||
use lettre::{self, message};
|
use lettre::{self, message};
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use serde_json::{self, json};
|
use serde_json::{self, json};
|
||||||
use zip;
|
|
||||||
|
use std::io::prelude::*;
|
||||||
|
|
||||||
|
pub mod send_mail_util;
|
||||||
|
pub mod zip_directory_util;
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
match dotenv::dotenv().ok() {
|
match dotenv::dotenv().ok() {
|
||||||
@@ -185,7 +187,10 @@ fn main() -> anyhow::Result<()> {
|
|||||||
// Read system prompt
|
// Read system prompt
|
||||||
let prompt = std::fs::read_to_string("PROMPT.txt").unwrap();
|
let prompt = std::fs::read_to_string("PROMPT.txt").unwrap();
|
||||||
let filter_file_contents = std::fs::read_to_string("FILTER.txt").unwrap_or(String::new());
|
let filter_file_contents = std::fs::read_to_string("FILTER.txt").unwrap_or(String::new());
|
||||||
let filter_keywords = filter_file_contents.split("\n").collect::<Vec<&str>>();
|
let filter_keywords = filter_file_contents
|
||||||
|
.split("\n")
|
||||||
|
.filter(|keyword| !keyword.is_empty())
|
||||||
|
.collect::<Vec<&str>>();
|
||||||
|
|
||||||
let talks_array = get_piperun_chats_on_date(
|
let talks_array = get_piperun_chats_on_date(
|
||||||
&PIPERUN_API_URL,
|
&PIPERUN_API_URL,
|
||||||
@@ -422,7 +427,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
.write_all(format!("{header}\n{response_time}").as_bytes())
|
.write_all(format!("{header}\n{response_time}").as_bytes())
|
||||||
.expect("Failed to write header to file");
|
.expect("Failed to write header to file");
|
||||||
|
|
||||||
filtered_chats.clone().skip(0).take(10).for_each(|result| {
|
filtered_chats.clone().skip(0).for_each(|result| {
|
||||||
let json = result.unwrap();
|
let json = result.unwrap();
|
||||||
let talk_histories = &json["talk_histories"];
|
let talk_histories = &json["talk_histories"];
|
||||||
let data = &talk_histories["data"];
|
let data = &talk_histories["data"];
|
||||||
@@ -516,21 +521,22 @@ fn main() -> anyhow::Result<()> {
|
|||||||
// Compress folder into zip
|
// Compress folder into zip
|
||||||
let source_dir_str = format!("./evaluations/{formatted_day_before}");
|
let source_dir_str = format!("./evaluations/{formatted_day_before}");
|
||||||
let output_zip_file_str = format!("./evaluations/{formatted_day_before}.zip");
|
let output_zip_file_str = format!("./evaluations/{formatted_day_before}.zip");
|
||||||
let source_dir = Path::new(source_dir_str.as_str());
|
let source_dir = std::path::Path::new(source_dir_str.as_str());
|
||||||
let output_zip_file = Path::new(output_zip_file_str.as_str());
|
let output_zip_file = std::path::Path::new(output_zip_file_str.as_str());
|
||||||
doit(source_dir, output_zip_file, zip::CompressionMethod::Stored);
|
zip_directory_util::zip_directory_util::zip_source_dir_to_dst_file(source_dir, output_zip_file);
|
||||||
|
|
||||||
// Send folder to email
|
// Send folder to email
|
||||||
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
||||||
println!("Trying to send email... Recipients {recipients}");
|
println!("Trying to send email... Recipients {recipients}");
|
||||||
|
|
||||||
send_email(
|
send_mail_util::send_mail_util::send_email(
|
||||||
&formatted_day_before,
|
&format!("Avaliacao atendimentos {formatted_day_before}"),
|
||||||
&BOT_EMAIL,
|
&BOT_EMAIL,
|
||||||
&BOT_EMAIL_PASSWORD,
|
&BOT_EMAIL_PASSWORD,
|
||||||
recipients,
|
recipients,
|
||||||
&output_zip_file_str,
|
&output_zip_file_str,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,6 +603,10 @@ fn get_piperun_chats_on_date(
|
|||||||
.as_i64()
|
.as_i64()
|
||||||
.expect("Failed to obtain current page number");
|
.expect("Failed to obtain current page number");
|
||||||
|
|
||||||
|
if current_page == last_page {
|
||||||
|
return aggregated_talks;
|
||||||
|
}
|
||||||
|
|
||||||
let mut all_other_messages = (current_page..last_page)
|
let mut all_other_messages = (current_page..last_page)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|page| {
|
.map(|page| {
|
||||||
@@ -653,118 +663,3 @@ fn get_piperun_chats_on_date(
|
|||||||
aggregated_talks.append(&mut all_other_messages);
|
aggregated_talks.append(&mut all_other_messages);
|
||||||
aggregated_talks
|
aggregated_talks
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::io::prelude::*;
|
|
||||||
use zip::{result::ZipError, write::SimpleFileOptions};
|
|
||||||
|
|
||||||
use std::fs::File;
|
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use walkdir::{DirEntry, WalkDir};
|
|
||||||
|
|
||||||
fn zip_dir<T>(
|
|
||||||
it: &mut dyn Iterator<Item = DirEntry>,
|
|
||||||
prefix: &Path,
|
|
||||||
writer: T,
|
|
||||||
method: zip::CompressionMethod,
|
|
||||||
) where
|
|
||||||
T: Write + Seek,
|
|
||||||
{
|
|
||||||
let mut zip = zip::ZipWriter::new(writer);
|
|
||||||
let options = SimpleFileOptions::default()
|
|
||||||
.compression_method(method)
|
|
||||||
.unix_permissions(0o755);
|
|
||||||
|
|
||||||
let prefix = Path::new(prefix);
|
|
||||||
let mut buffer = Vec::new();
|
|
||||||
for entry in it {
|
|
||||||
let path = entry.path();
|
|
||||||
let name = path.strip_prefix(prefix).unwrap();
|
|
||||||
let path_as_string = name
|
|
||||||
.to_str()
|
|
||||||
.map(str::to_owned)
|
|
||||||
.expect("Failed to parse path");
|
|
||||||
|
|
||||||
// Write file or directory explicitly
|
|
||||||
// Some unzip tools unzip files with directory paths correctly, some do not!
|
|
||||||
if path.is_file() {
|
|
||||||
println!("adding file {path:?} as {name:?} ...");
|
|
||||||
zip.start_file(path_as_string, options)
|
|
||||||
.expect("Failed to add file");
|
|
||||||
let mut f = File::open(path).unwrap();
|
|
||||||
|
|
||||||
f.read_to_end(&mut buffer).expect("Failed to read file");
|
|
||||||
zip.write_all(&buffer).expect("Failed to write file");
|
|
||||||
buffer.clear();
|
|
||||||
} else if !name.as_os_str().is_empty() {
|
|
||||||
// Only if not root! Avoids path spec / warning
|
|
||||||
// and mapname conversion failed error on unzip
|
|
||||||
println!("adding dir {path_as_string:?} as {name:?} ...");
|
|
||||||
zip.add_directory(path_as_string, options)
|
|
||||||
.expect("Failed to add directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
zip.finish().expect("Failed to ZIP");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn doit(src_dir: &Path, dst_file: &Path, method: zip::CompressionMethod) {
|
|
||||||
if !Path::new(src_dir).is_dir() {
|
|
||||||
panic!("src_dir must be a directory");
|
|
||||||
}
|
|
||||||
|
|
||||||
let path = Path::new(dst_file);
|
|
||||||
let file = File::create(path).unwrap();
|
|
||||||
|
|
||||||
let walkdir = WalkDir::new(src_dir);
|
|
||||||
let it = walkdir.into_iter();
|
|
||||||
|
|
||||||
zip_dir(&mut it.filter_map(|e| e.ok()), src_dir, file, method);
|
|
||||||
}
|
|
||||||
|
|
||||||
use lettre::{
|
|
||||||
Message, SmtpTransport, Transport,
|
|
||||||
message::Attachment,
|
|
||||||
message::MultiPart,
|
|
||||||
message::SinglePart,
|
|
||||||
message::header::ContentType,
|
|
||||||
transport::smtp::authentication::{Credentials, Mechanism},
|
|
||||||
};
|
|
||||||
|
|
||||||
fn send_email(
|
|
||||||
day_before: &str,
|
|
||||||
bot_email: &str,
|
|
||||||
bot_email_password: &str,
|
|
||||||
to: &str,
|
|
||||||
zip_file_name: &str,
|
|
||||||
) {
|
|
||||||
let filebody = std::fs::read(zip_file_name).unwrap();
|
|
||||||
let content_type = ContentType::parse("application/zip").unwrap();
|
|
||||||
let attachment = Attachment::new(zip_file_name.to_string()).body(filebody, content_type);
|
|
||||||
let mailboxes: Mailboxes = to.parse().unwrap();
|
|
||||||
let to_header: message::header::To = mailboxes.into();
|
|
||||||
|
|
||||||
let email = Message::builder()
|
|
||||||
.from(format!("PipeRUN bot <{bot_email}>").parse().unwrap())
|
|
||||||
.reply_to(format!("PipeRUN bot <{bot_email}>").parse().unwrap())
|
|
||||||
.mailbox(to_header)
|
|
||||||
.subject(format!("Avaliacao atendimentos {day_before}"))
|
|
||||||
.multipart(
|
|
||||||
MultiPart::mixed()
|
|
||||||
.singlepart(
|
|
||||||
SinglePart::builder()
|
|
||||||
.header(ContentType::TEXT_PLAIN)
|
|
||||||
.body(String::from("Avaliacao dos atendimentos")),
|
|
||||||
)
|
|
||||||
.singlepart(attachment),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Create the SMTPS transport
|
|
||||||
let sender = SmtpTransport::from_url(&format!(
|
|
||||||
"smtps://{bot_email}:{bot_email_password}@mail.nova.net.br"
|
|
||||||
))
|
|
||||||
.unwrap()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Send the email via remote relay
|
|
||||||
sender.send(&email).unwrap();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
pub mod zip_directory_util {
|
pub mod zip_directory_util {
|
||||||
|
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use zip::write::SimpleFileOptions;
|
use zip::write::SimpleFileOptions;
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
fn zip_dir<T>(
|
fn zip_dir<T>(
|
||||||
it: &mut dyn Iterator<Item = DirEntry>,
|
it: &mut dyn Iterator<Item = DirEntry>,
|
||||||
prefix: &Path,
|
prefix: &Path,
|
||||||
writer: T,
|
writer: T,
|
||||||
method: zip::CompressionMethod,
|
method: zip::CompressionMethod,
|
||||||
) where
|
) where
|
||||||
T: Write + Seek,
|
T: Write + Seek,
|
||||||
{
|
{
|
||||||
let mut zip = zip::ZipWriter::new(writer);
|
let mut zip = zip::ZipWriter::new(writer);
|
||||||
let options = SimpleFileOptions::default()
|
let options = SimpleFileOptions::default()
|
||||||
.compression_method(method)
|
.compression_method(method)
|
||||||
@@ -50,9 +50,9 @@ fn zip_dir<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
zip.finish().expect("Failed to ZIP");
|
zip.finish().expect("Failed to ZIP");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn zip_source_dir_to_dst_file(src_dir: &Path, dst_file: &Path) {
|
pub fn zip_source_dir_to_dst_file(src_dir: &Path, dst_file: &Path) {
|
||||||
if !Path::new(src_dir).is_dir() {
|
if !Path::new(src_dir).is_dir() {
|
||||||
panic!("src_dir must be a directory");
|
panic!("src_dir must be a directory");
|
||||||
}
|
}
|
||||||
@@ -65,6 +65,5 @@ pub fn zip_source_dir_to_dst_file(src_dir: &Path, dst_file: &Path) {
|
|||||||
let it = walkdir.into_iter();
|
let it = walkdir.into_iter();
|
||||||
|
|
||||||
zip_dir(&mut it.filter_map(|e| e.ok()), src_dir, file, method);
|
zip_dir(&mut it.filter_map(|e| e.ok()), src_dir, file, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user