aiwf 0.3.22 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/.claude-plugin/marketplace.json +146 -0
  2. package/CHANGELOG.md +49 -1
  3. package/README.ko.md +118 -309
  4. package/README.md +68 -254
  5. package/docs/modernization/BROWNFIELD-GREENFIELD.ko.md +105 -0
  6. package/docs/modernization/CLAUDE-PLAN-REVIEW-2026-10-03.ko.md +77 -0
  7. package/docs/modernization/CLI-PRODUCTIVITY-REVIEWED-2026-10-03.ko.md +177 -0
  8. package/docs/modernization/CLI-PRODUCTIVITY.ko.md +193 -0
  9. package/docs/modernization/CORE-PACKAGE-PLAN.md +7 -0
  10. package/docs/modernization/DEEP-REVERSE-ENGINEERING.ko.md +88 -0
  11. package/docs/modernization/DELEGATION-OPTIONAL.ko.md +57 -0
  12. package/docs/modernization/DIRECTION.ko.md +56 -0
  13. package/docs/modernization/FULL-TEST-2026-10-03.md +49 -0
  14. package/docs/modernization/LEGACY-REMOVAL-PLAN.md +9 -0
  15. package/docs/modernization/PILOT-RESULT-2026-10-03.ko.md +85 -0
  16. package/docs/modernization/PILOT-UC-001.ko.md +79 -0
  17. package/docs/modernization/PLAN.md +28 -0
  18. package/docs/modernization/SKILLS.ko.md +105 -0
  19. package/docs/modernization/SPRINTABLE.ko.md +47 -0
  20. package/docs/modernization/SYNC-DOCS-VALIDATION-2026-10-04.ko.md +38 -0
  21. package/docs/modernization/VALIDATION.md +79 -0
  22. package/docs/modernization/evidence/example-review-packet.json +115 -0
  23. package/docs/modernization/evidence/example-spec-pin.json +48 -0
  24. package/docs/modernization/evidence/full-test-20261003/claude-lint.md +22 -0
  25. package/docs/modernization/evidence/full-test-20261003/claude-review-retry.md +56 -0
  26. package/docs/modernization/evidence/full-test-20261003/codex-review-packet.json +159 -0
  27. package/docs/modernization/evidence/full-test-20261003/src/expense.mjs +40 -0
  28. package/docs/modernization/evidence/full-test-20261003/summary.json +106 -0
  29. package/docs/modernization/evidence/full-test-20261003/tests/expense.test.mjs +61 -0
  30. package/docs/modernization/evidence/local-pilot-20261003/README.ko.md +40 -0
  31. package/docs/modernization/evidence/local-pilot-20261003/execution.json +1055 -0
  32. package/docs/modernization/evidence/local-pilot-20261003/maintenance/dependencies.json +24 -0
  33. package/docs/modernization/evidence/local-pilot-20261003/maintenance/dependencies.stderr.txt +0 -0
  34. package/docs/modernization/evidence/local-pilot-20261003/maintenance/dependencies.stdout.txt +5 -0
  35. package/docs/modernization/evidence/local-pilot-20261003/maintenance/docs.json +24 -0
  36. package/docs/modernization/evidence/local-pilot-20261003/maintenance/docs.stderr.txt +0 -0
  37. package/docs/modernization/evidence/local-pilot-20261003/maintenance/docs.stdout.txt +6 -0
  38. package/docs/modernization/evidence/local-pilot-20261003/maintenance/example.json +24 -0
  39. package/docs/modernization/evidence/local-pilot-20261003/maintenance/example.stderr.txt +0 -0
  40. package/docs/modernization/evidence/local-pilot-20261003/maintenance/example.stdout.txt +5 -0
  41. package/docs/modernization/evidence/local-pilot-20261003/maintenance/local-docs.json +24 -0
  42. package/docs/modernization/evidence/local-pilot-20261003/maintenance/local-docs.stderr.txt +0 -0
  43. package/docs/modernization/evidence/local-pilot-20261003/maintenance/local-docs.stdout.txt +6 -0
  44. package/docs/modernization/evidence/local-pilot-20261003/maintenance/node.json +23 -0
  45. package/docs/modernization/evidence/local-pilot-20261003/maintenance/node.stderr.txt +0 -0
  46. package/docs/modernization/evidence/local-pilot-20261003/maintenance/node.stdout.txt +535 -0
  47. package/docs/modernization/evidence/local-pilot-20261003/maintenance/provenance.json +24 -0
  48. package/docs/modernization/evidence/local-pilot-20261003/maintenance/provenance.stderr.txt +0 -0
  49. package/docs/modernization/evidence/local-pilot-20261003/maintenance/provenance.stdout.txt +5 -0
  50. package/docs/modernization/evidence/local-pilot-20261003/maintenance/readme-replay.json +24 -0
  51. package/docs/modernization/evidence/local-pilot-20261003/maintenance/readme-replay.stderr.txt +0 -0
  52. package/docs/modernization/evidence/local-pilot-20261003/maintenance/readme-replay.stdout.txt +273 -0
  53. package/docs/modernization/evidence/local-pilot-20261003/maintenance/upstream.json +24 -0
  54. package/docs/modernization/evidence/local-pilot-20261003/maintenance/upstream.stderr.txt +0 -0
  55. package/docs/modernization/evidence/local-pilot-20261003/maintenance/upstream.stdout.txt +7 -0
  56. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/archive-service.stderr.txt +0 -0
  57. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/archive-service.stdout.txt +148 -0
  58. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/archive-structure.stderr.txt +0 -0
  59. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/archive-structure.stdout.txt +9 -0
  60. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-check.stderr.txt +0 -0
  61. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-check.stdout.txt +67 -0
  62. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-evidence.json +34 -0
  63. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-packet.json +128 -0
  64. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-packet.stderr.txt +0 -0
  65. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-packet.stdout.txt +128 -0
  66. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-pin.json +54 -0
  67. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-pin.stderr.txt +0 -0
  68. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-pin.stdout.txt +60 -0
  69. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-readback.json +15 -0
  70. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-service.stderr.txt +0 -0
  71. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-service.stdout.txt +82 -0
  72. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-structure.stderr.txt +0 -0
  73. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/baseline-structure.stdout.txt +9 -0
  74. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-check.stderr.txt +0 -0
  75. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-check.stdout.txt +79 -0
  76. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-packet-refused.stderr.txt +0 -0
  77. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-packet-refused.stdout.txt +7 -0
  78. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-pin-refresh.stderr.txt +0 -0
  79. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-pin-refresh.stdout.txt +66 -0
  80. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-pin.json +60 -0
  81. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-structure.stderr.txt +0 -0
  82. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/changed-structure.stdout.txt +9 -0
  83. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-check.stderr.txt +0 -0
  84. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-check.stdout.txt +73 -0
  85. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-evidence.json +34 -0
  86. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-packet.json +134 -0
  87. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-packet.stderr.txt +0 -0
  88. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-packet.stdout.txt +134 -0
  89. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-readback.json +15 -0
  90. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-service.stderr.txt +0 -0
  91. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-service.stdout.txt +148 -0
  92. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-structure.stderr.txt +0 -0
  93. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/final-structure.stdout.txt +9 -0
  94. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/node-version.stderr.txt +0 -0
  95. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/node-version.stdout.txt +1 -0
  96. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/python-version.stderr.txt +0 -0
  97. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/python-version.stdout.txt +1 -0
  98. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-evidence.json +34 -0
  99. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-packet.json +134 -0
  100. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-packet.stderr.txt +0 -0
  101. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-packet.stdout.txt +134 -0
  102. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-readback.json +15 -0
  103. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-service.stderr.txt +0 -0
  104. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-service.stdout.txt +266 -0
  105. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-structure.stderr.txt +0 -0
  106. package/docs/modernization/evidence/local-pilot-20261003/project/artifacts/red-structure.stdout.txt +9 -0
  107. package/docs/modernization/evidence/local-pilot-20261003/project/docs/entity_model.md +33 -0
  108. package/docs/modernization/evidence/local-pilot-20261003/project/docs/glossary.md +9 -0
  109. package/docs/modernization/evidence/local-pilot-20261003/project/docs/plans/UC-001.md +20 -0
  110. package/docs/modernization/evidence/local-pilot-20261003/project/docs/requirements.md +10 -0
  111. package/docs/modernization/evidence/local-pilot-20261003/project/docs/test_cases/TC-001-submit-expense.md +37 -0
  112. package/docs/modernization/evidence/local-pilot-20261003/project/docs/test_cases/TC-002-description-limit.md +42 -0
  113. package/docs/modernization/evidence/local-pilot-20261003/project/docs/use_cases/UC-001-submit-expense.md +76 -0
  114. package/docs/modernization/evidence/local-pilot-20261003/project/docs/use_cases.puml +12 -0
  115. package/docs/modernization/evidence/local-pilot-20261003/project/docs/vision.md +21 -0
  116. package/docs/modernization/evidence/local-pilot-20261003/project/src/expense.mjs +48 -0
  117. package/docs/modernization/evidence/local-pilot-20261003/project/tests/expense.test.mjs +116 -0
  118. package/docs/modernization/evidence/local-pilot-20261003/scope.json +31 -0
  119. package/docs/modernization/reviews/2026-10-03-claude-cli/CONTRACTS.ko.md +122 -0
  120. package/docs/modernization/reviews/2026-10-03-claude-cli/DIRECTION.ko.md +84 -0
  121. package/examples/spec-workflow/README.md +54 -0
  122. package/examples/spec-workflow/docs/entity_model.md +33 -0
  123. package/examples/spec-workflow/docs/glossary.md +9 -0
  124. package/examples/spec-workflow/docs/requirements.md +10 -0
  125. package/examples/spec-workflow/docs/test_cases/TC-001-submit-expense.md +37 -0
  126. package/examples/spec-workflow/docs/use_cases/UC-001-submit-expense.md +63 -0
  127. package/examples/spec-workflow/docs/use_cases.puml +12 -0
  128. package/examples/spec-workflow/docs/vision.md +21 -0
  129. package/package.json +37 -104
  130. package/plugins/aiwf-angular-jpa/.claude-plugin/plugin.json +11 -0
  131. package/plugins/aiwf-angular-jpa/LICENSE +201 -0
  132. package/plugins/aiwf-angular-jpa/NOTICE +16 -0
  133. package/plugins/aiwf-angular-jpa/README.md +54 -0
  134. package/plugins/aiwf-angular-jpa/UPSTREAM.json +35 -0
  135. package/plugins/aiwf-angular-jpa/agents/uc-coverage.md +263 -0
  136. package/plugins/aiwf-angular-jpa/rules/mcp-servers.md +64 -0
  137. package/plugins/aiwf-angular-jpa/skills/coverage-check/SKILL.md +190 -0
  138. package/plugins/aiwf-angular-jpa/skills/flyway-migration/SKILL.md +119 -0
  139. package/plugins/aiwf-angular-jpa/skills/implement/SKILL.md +528 -0
  140. package/plugins/aiwf-angular-jpa/skills/implement/references/module-layout.md +95 -0
  141. package/plugins/aiwf-angular-jpa/skills/playwright-test/SKILL.md +360 -0
  142. package/plugins/aiwf-angular-jpa/skills/spring-boot-test/SKILL.md +504 -0
  143. package/plugins/aiwf-angular-jpa/skills/vitest-test/SKILL.md +309 -0
  144. package/plugins/aiwf-blazor-dotnet/.claude-plugin/plugin.json +11 -0
  145. package/plugins/aiwf-blazor-dotnet/LICENSE +201 -0
  146. package/plugins/aiwf-blazor-dotnet/NOTICE +16 -0
  147. package/plugins/aiwf-blazor-dotnet/README.md +53 -0
  148. package/plugins/aiwf-blazor-dotnet/UPSTREAM.json +31 -0
  149. package/plugins/aiwf-blazor-dotnet/rules/mcp-servers.md +25 -0
  150. package/plugins/aiwf-blazor-dotnet/skills/bunit-test/SKILL.md +110 -0
  151. package/plugins/aiwf-blazor-dotnet/skills/dotnet-test/SKILL.md +108 -0
  152. package/plugins/aiwf-blazor-dotnet/skills/ef-migration/SKILL.md +43 -0
  153. package/plugins/aiwf-blazor-dotnet/skills/implement/SKILL.md +149 -0
  154. package/plugins/aiwf-blazor-dotnet/skills/playwright-test/SKILL.md +130 -0
  155. package/plugins/aiwf-core/.claude-plugin/plugin.json +11 -0
  156. package/plugins/aiwf-core/LICENSE +201 -0
  157. package/plugins/aiwf-core/NOTICE +20 -0
  158. package/plugins/aiwf-core/README.md +38 -0
  159. package/plugins/aiwf-core/UPSTREAM.json +50 -0
  160. package/plugins/aiwf-core/skills/entity-model/SKILL.md +160 -0
  161. package/plugins/aiwf-core/skills/entity-model/references/REFERENCE.md +36 -0
  162. package/plugins/aiwf-core/skills/requirements/SKILL.md +157 -0
  163. package/plugins/aiwf-core/skills/requirements/references/REFERENCE.md +70 -0
  164. package/plugins/aiwf-core/skills/requirements/references/glossary.md +7 -0
  165. package/plugins/aiwf-core/skills/reverse-engineer/SKILL.md +509 -0
  166. package/plugins/aiwf-core/skills/reverse-engineer/references/stack-signals.md +210 -0
  167. package/plugins/aiwf-core/skills/spec-review/SKILL.md +197 -0
  168. package/plugins/aiwf-core/skills/spec-review/references/lint-codes.md +63 -0
  169. package/plugins/aiwf-core/skills/spec-review/references/review-checklist.md +189 -0
  170. package/plugins/aiwf-core/skills/spec-review/scripts/spec_lint.py +1216 -0
  171. package/plugins/aiwf-core/skills/test-case/SKILL.md +138 -0
  172. package/plugins/aiwf-core/skills/test-case/references/example-process.bpmn +118 -0
  173. package/plugins/aiwf-core/skills/test-case/references/example.md +38 -0
  174. package/plugins/aiwf-core/skills/test-case/references/test-case.md +35 -0
  175. package/plugins/aiwf-core/skills/test-case/scripts/bpmn_paths.py +542 -0
  176. package/plugins/aiwf-core/skills/use-case-diagram/SKILL.md +99 -0
  177. package/plugins/aiwf-core/skills/use-case-spec/SKILL.md +257 -0
  178. package/plugins/aiwf-core/skills/use-case-spec/references/clarify-checklist.md +70 -0
  179. package/plugins/aiwf-core/skills/use-case-spec/references/example.md +88 -0
  180. package/plugins/aiwf-core/skills/use-case-spec/references/format-spec.md +246 -0
  181. package/plugins/aiwf-core/skills/use-case-spec/references/use-case.md +50 -0
  182. package/plugins/aiwf-core/skills/use-case-spec/scripts/validate_use_case.py +941 -0
  183. package/plugins/aiwf-delegate-claude/.claude-plugin/plugin.json +9 -0
  184. package/{src/lib/resources/templates/npm-library/template → plugins/aiwf-delegate-claude}/LICENSE +2 -2
  185. package/plugins/aiwf-delegate-claude/NOTICE +4 -0
  186. package/plugins/aiwf-delegate-claude/README.md +10 -0
  187. package/plugins/aiwf-delegate-claude/plugin.json +13 -0
  188. package/plugins/aiwf-delegate-claude/skills/delegate-claude/LICENSE +21 -0
  189. package/plugins/aiwf-delegate-claude/skills/delegate-claude/NOTICE +4 -0
  190. package/plugins/aiwf-delegate-claude/skills/delegate-claude/SKILL.md +49 -0
  191. package/plugins/aiwf-delegate-claude/skills/delegate-claude/agents/openai.yaml +2 -0
  192. package/plugins/aiwf-delegate-codex/.claude-plugin/plugin.json +9 -0
  193. package/plugins/aiwf-delegate-codex/LICENSE +21 -0
  194. package/plugins/aiwf-delegate-codex/NOTICE +4 -0
  195. package/plugins/aiwf-delegate-codex/README.md +10 -0
  196. package/plugins/aiwf-delegate-codex/plugin.json +13 -0
  197. package/plugins/aiwf-delegate-codex/skills/delegate-codex/LICENSE +21 -0
  198. package/plugins/aiwf-delegate-codex/skills/delegate-codex/NOTICE +4 -0
  199. package/plugins/aiwf-delegate-codex/skills/delegate-codex/SKILL.md +47 -0
  200. package/plugins/aiwf-delegate-codex/skills/delegate-codex/agents/openai.yaml +2 -0
  201. package/plugins/aiwf-nestjs-nextjs/.claude-plugin/plugin.json +11 -0
  202. package/plugins/aiwf-nestjs-nextjs/LICENSE +201 -0
  203. package/plugins/aiwf-nestjs-nextjs/NOTICE +16 -0
  204. package/plugins/aiwf-nestjs-nextjs/README.md +53 -0
  205. package/plugins/aiwf-nestjs-nextjs/UPSTREAM.json +32 -0
  206. package/plugins/aiwf-nestjs-nextjs/rules/mcp-servers.md +59 -0
  207. package/plugins/aiwf-nestjs-nextjs/skills/drizzle-migration/SKILL.md +222 -0
  208. package/plugins/aiwf-nestjs-nextjs/skills/implement/SKILL.md +393 -0
  209. package/plugins/aiwf-nestjs-nextjs/skills/implement/references/project-layout.md +158 -0
  210. package/plugins/aiwf-nestjs-nextjs/skills/nest-test/SKILL.md +300 -0
  211. package/plugins/aiwf-nestjs-nextjs/skills/playwright-test/SKILL.md +245 -0
  212. package/plugins/aiwf-nestjs-nextjs/skills/react-test/SKILL.md +217 -0
  213. package/plugins/aiwf-spec/.claude-plugin/plugin.json +9 -0
  214. package/plugins/aiwf-spec/LICENSE +201 -0
  215. package/plugins/aiwf-spec/NOTICE +20 -0
  216. package/plugins/aiwf-spec/README.md +36 -0
  217. package/plugins/aiwf-spec/skills/sync-docs/SKILL.md +47 -0
  218. package/plugins/aiwf-spec/skills/workflow/SKILL.md +42 -0
  219. package/plugins/aiwf-vaadin-jooq/.claude-plugin/plugin.json +11 -0
  220. package/plugins/aiwf-vaadin-jooq/LICENSE +201 -0
  221. package/plugins/aiwf-vaadin-jooq/NOTICE +16 -0
  222. package/plugins/aiwf-vaadin-jooq/README.md +56 -0
  223. package/plugins/aiwf-vaadin-jooq/UPSTREAM.json +43 -0
  224. package/plugins/aiwf-vaadin-jooq/agents/uc-coverage.md +260 -0
  225. package/plugins/aiwf-vaadin-jooq/rules/mcp-servers.md +44 -0
  226. package/plugins/aiwf-vaadin-jooq/skills/browserless-test/SKILL.md +407 -0
  227. package/plugins/aiwf-vaadin-jooq/skills/browserless-test/references/UC001ManagePersonsTest.java +111 -0
  228. package/plugins/aiwf-vaadin-jooq/skills/coverage-check/SKILL.md +190 -0
  229. package/plugins/aiwf-vaadin-jooq/skills/flyway-migration/SKILL.md +70 -0
  230. package/plugins/aiwf-vaadin-jooq/skills/hilla-test/SKILL.md +350 -0
  231. package/plugins/aiwf-vaadin-jooq/skills/hilla-test/references/UC001ManagePersonsServiceTest.java +81 -0
  232. package/plugins/aiwf-vaadin-jooq/skills/hilla-test/references/UC001ManagePersonsViewTest.tsx +87 -0
  233. package/plugins/aiwf-vaadin-jooq/skills/implement/SKILL.md +196 -0
  234. package/plugins/aiwf-vaadin-jooq/skills/implement-hilla/SKILL.md +216 -0
  235. package/plugins/aiwf-vaadin-jooq/skills/karibu-test/SKILL.md +298 -0
  236. package/plugins/aiwf-vaadin-jooq/skills/karibu-test/references/UC001ManagePersonsTest.java +93 -0
  237. package/plugins/aiwf-vaadin-jooq/skills/playwright-test/SKILL.md +237 -0
  238. package/plugins/aiwf-vaadin-jooq/skills/playwright-test/references/ExampleViewIT.java +143 -0
  239. package/plugins/aiwf-vaadin-jooq/skills/playwright-test/references/TC001CustomerOnboardingIT.java +144 -0
  240. package/plugins/aiwf-vaadin-jooq/skills/playwright-test/references/dramafinder-api.md +190 -0
  241. package/scripts/check-dependencies.js +26 -96
  242. package/scripts/install-spec-skills.mjs +126 -0
  243. package/scripts/validate-spec-plugin.mjs +145 -0
  244. package/src/cli/spec-cli.js +292 -0
  245. package/src/lib/spec-workflow.js +982 -0
  246. package/docs/ADR_MANAGEMENT_GUIDE.ko.md +0 -602
  247. package/docs/ADR_MANAGEMENT_GUIDE.md +0 -602
  248. package/docs/AI-WORKFLOW.ko.md +0 -299
  249. package/docs/AI-WORKFLOW.md +0 -401
  250. package/docs/API_REFERENCE_FULL.ko.md +0 -1135
  251. package/docs/API_REFERENCE_FULL.md +0 -1135
  252. package/docs/ARCHITECTURE.ko.md +0 -314
  253. package/docs/ARCHITECTURE.md +0 -314
  254. package/docs/CLI_USAGE_GUIDE.ko.md +0 -634
  255. package/docs/CLI_USAGE_GUIDE.md +0 -640
  256. package/docs/CODE_CLEANUP_GUIDE.ko.md +0 -415
  257. package/docs/CODE_CLEANUP_GUIDE.md +0 -415
  258. package/docs/COMMANDS_GUIDE.ko.md +0 -1037
  259. package/docs/COMMANDS_GUIDE.md +0 -1037
  260. package/docs/CONTRIBUTING.ko.md +0 -408
  261. package/docs/CONTRIBUTING.md +0 -408
  262. package/docs/DEVELOPMENT_GUIDE.ko.md +0 -440
  263. package/docs/DEVELOPMENT_GUIDE.md +0 -727
  264. package/docs/EXAMPLES.ko.md +0 -695
  265. package/docs/EXAMPLES.md +0 -693
  266. package/docs/GETTING_STARTED.ko.md +0 -219
  267. package/docs/GETTING_STARTED.md +0 -476
  268. package/docs/MODULE_MANAGEMENT_GUIDE.ko.md +0 -289
  269. package/docs/MODULE_MANAGEMENT_GUIDE.md +0 -289
  270. package/docs/PERFORMANCE_ARCHITECTURE.md +0 -494
  271. package/docs/PERFORMANCE_GUIDELINES.ko.md +0 -388
  272. package/docs/PERFORMANCE_GUIDELINES.md +0 -553
  273. package/docs/PRD.ko.md +0 -148
  274. package/docs/PRD.md +0 -150
  275. package/docs/ROADMAP_v0.4.0.md +0 -286
  276. package/docs/STATE_MANAGEMENT_GUIDE.ko.md +0 -278
  277. package/docs/STATE_MANAGEMENT_GUIDE.md +0 -278
  278. package/docs/TROUBLESHOOTING.ko.md +0 -366
  279. package/docs/TROUBLESHOOTING.md +0 -722
  280. package/docs/VALIDATOR_API.ko.md +0 -324
  281. package/docs/VALIDATOR_API.md +0 -324
  282. package/docs/YOLO_SYSTEM_GUIDE.ko.md +0 -542
  283. package/docs/YOLO_SYSTEM_GUIDE.md +0 -542
  284. package/docs/designs/AI_PERSONA_SYSTEM_DESIGN.md +0 -516
  285. package/docs/designs/API_DOCUMENTATION.md +0 -932
  286. package/docs/designs/API_REFERENCE.md +0 -979
  287. package/docs/designs/Enhanced_Installation_Flow_Design.md +0 -498
  288. package/docs/designs/aiwf-metadata-system-prd.md +0 -127
  289. package/docs/designs/offline-template-cache.md +0 -323
  290. package/docs/designs/persona-aware-compression.md +0 -168
  291. package/docs/guides/ai-personas-guide-ko.md +0 -239
  292. package/docs/guides/ai-personas-guide.md +0 -239
  293. package/docs/guides/checkpoint-system-guide-ko.md +0 -356
  294. package/docs/guides/checkpoint-system-guide.md +0 -356
  295. package/docs/guides/context-compression-guide-ko.md +0 -313
  296. package/docs/guides/context-compression-guide.md +0 -313
  297. package/docs/guides/independent-sprint-guide-ko.md +0 -321
  298. package/docs/guides/independent-sprint-guide.md +0 -321
  299. package/rules/global/aiwf-code-style-guide.md +0 -30
  300. package/rules/global/aiwf-coding-principles.md +0 -33
  301. package/rules/global/aiwf-development-process.md +0 -41
  302. package/rules/global/aiwf-global-rules.md +0 -84
  303. package/rules/manual/aiwf-generate-plan-docs.md +0 -280
  304. package/scripts/run-integration-tests.js +0 -317
  305. package/scripts/update-file-lists.js +0 -267
  306. package/scripts/validate-commands.js +0 -254
  307. package/src/DEPENDENCY_MAP.md +0 -90
  308. package/src/cli/cache-cli.js +0 -459
  309. package/src/cli/checkpoint-cli.js +0 -417
  310. package/src/cli/index.js +0 -481
  311. package/src/cli/language-cli.js +0 -286
  312. package/src/cli/sprint-cli.js +0 -287
  313. package/src/commands/ai-tool.js +0 -383
  314. package/src/commands/compress.js +0 -60
  315. package/src/commands/create-project.js +0 -160
  316. package/src/commands/evaluate.js +0 -459
  317. package/src/commands/persona.js +0 -309
  318. package/src/commands/sprint-independent.js +0 -393
  319. package/src/commands/sprint-task.js +0 -262
  320. package/src/commands/state.js +0 -1164
  321. package/src/commands/token.js +0 -312
  322. package/src/commands/yolo-config.js +0 -502
  323. package/src/config/file-lists.js +0 -147
  324. package/src/config/yolo-config-template.yaml +0 -168
  325. package/src/lib/ai-persona-manager.js +0 -711
  326. package/src/lib/backup-manager.js +0 -271
  327. package/src/lib/cache-system.js +0 -332
  328. package/src/lib/context-engine.js +0 -568
  329. package/src/lib/file-downloader.js +0 -304
  330. package/src/lib/github-integration.js +0 -402
  331. package/src/lib/installer.js +0 -1066
  332. package/src/lib/memory-profiler.js +0 -471
  333. package/src/lib/metrics-collector.js +0 -885
  334. package/src/lib/offline-detector.js +0 -386
  335. package/src/lib/resource-loader-enhanced.js +0 -399
  336. package/src/lib/resource-loader.js +0 -250
  337. package/src/lib/resources/commands/ai-persona.js +0 -602
  338. package/src/lib/resources/commands/compress-context.js +0 -389
  339. package/src/lib/resources/commands/evaluate.js +0 -246
  340. package/src/lib/resources/commands/persona-context-apply.js +0 -562
  341. package/src/lib/resources/commands/token-tracking.js +0 -443
  342. package/src/lib/resources/config/commit-patterns.js +0 -103
  343. package/src/lib/resources/config/language.json +0 -6
  344. package/src/lib/resources/personas/PERSONA_INDEX.md +0 -57
  345. package/src/lib/resources/personas/analyst.json +0 -44
  346. package/src/lib/resources/personas/architect/best_practices.md +0 -136
  347. package/src/lib/resources/personas/architect/knowledge_base.md +0 -377
  348. package/src/lib/resources/personas/architect.json +0 -44
  349. package/src/lib/resources/personas/backend/best_practices.md +0 -766
  350. package/src/lib/resources/personas/backend/knowledge_base.md +0 -1070
  351. package/src/lib/resources/personas/data_analyst/best_practices.md +0 -594
  352. package/src/lib/resources/personas/data_analyst/knowledge_base.md +0 -1057
  353. package/src/lib/resources/personas/developer.json +0 -44
  354. package/src/lib/resources/personas/developer.md +0 -37
  355. package/src/lib/resources/personas/evaluation_criteria.json +0 -137
  356. package/src/lib/resources/personas/frontend/best_practices.md +0 -445
  357. package/src/lib/resources/personas/frontend/knowledge_base.md +0 -729
  358. package/src/lib/resources/personas/persona-index.json +0 -31
  359. package/src/lib/resources/personas/reviewer.json +0 -44
  360. package/src/lib/resources/personas/security/best_practices.md +0 -307
  361. package/src/lib/resources/personas/security/knowledge_base.md +0 -498
  362. package/src/lib/resources/personas/tester.json +0 -44
  363. package/src/lib/resources/templates/README.md +0 -78
  364. package/src/lib/resources/templates/api-server/config.json +0 -64
  365. package/src/lib/resources/templates/api-server/template/.aiwf/config.json +0 -56
  366. package/src/lib/resources/templates/api-server/template/.aiwf/feature-ledger.json +0 -42
  367. package/src/lib/resources/templates/api-server/template/.aiwf/personas/backend-engineer.json +0 -40
  368. package/src/lib/resources/templates/api-server/template/.aiwf/scripts/cli.js +0 -111
  369. package/src/lib/resources/templates/api-server/template/.env.example +0 -29
  370. package/src/lib/resources/templates/api-server/template/.eslintrc.json +0 -23
  371. package/src/lib/resources/templates/api-server/template/README.md +0 -171
  372. package/src/lib/resources/templates/api-server/template/jest.config.js +0 -26
  373. package/src/lib/resources/templates/api-server/template/nodemon.json +0 -9
  374. package/src/lib/resources/templates/api-server/template/package.json +0 -61
  375. package/src/lib/resources/templates/api-server/template/src/app.ts +0 -60
  376. package/src/lib/resources/templates/api-server/template/src/config/swagger.ts +0 -38
  377. package/src/lib/resources/templates/api-server/template/src/controllers/aiwfController.ts +0 -54
  378. package/src/lib/resources/templates/api-server/template/src/controllers/authController.ts +0 -128
  379. package/src/lib/resources/templates/api-server/template/src/controllers/statusController.ts +0 -28
  380. package/src/lib/resources/templates/api-server/template/src/index.ts +0 -28
  381. package/src/lib/resources/templates/api-server/template/src/middleware/aiwfMiddleware.ts +0 -50
  382. package/src/lib/resources/templates/api-server/template/src/middleware/authMiddleware.ts +0 -41
  383. package/src/lib/resources/templates/api-server/template/src/middleware/errorHandler.ts +0 -42
  384. package/src/lib/resources/templates/api-server/template/src/middleware/notFoundHandler.ts +0 -14
  385. package/src/lib/resources/templates/api-server/template/src/middleware/requestLogger.ts +0 -20
  386. package/src/lib/resources/templates/api-server/template/src/routes/aiwf.ts +0 -31
  387. package/src/lib/resources/templates/api-server/template/src/routes/index.ts +0 -13
  388. package/src/lib/resources/templates/api-server/template/src/routes/v1/index.ts +0 -67
  389. package/src/lib/resources/templates/api-server/template/src/utils/logger.ts +0 -37
  390. package/src/lib/resources/templates/api-server/template/tests/app.test.ts +0 -40
  391. package/src/lib/resources/templates/api-server/template/tsconfig.json +0 -43
  392. package/src/lib/resources/templates/npm-library/config.json +0 -61
  393. package/src/lib/resources/templates/npm-library/template/README.md +0 -201
  394. package/src/lib/resources/templates/npm-library/template/package.json +0 -78
  395. package/src/lib/resources/templates/web-app/config.json +0 -53
  396. package/src/lib/resources/templates/web-app/template/.aiwf/config.json +0 -54
  397. package/src/lib/resources/templates/web-app/template/.aiwf/feature-ledger.json +0 -37
  398. package/src/lib/resources/templates/web-app/template/.aiwf/personas/fullstack-developer.json +0 -40
  399. package/src/lib/resources/templates/web-app/template/.aiwf/scripts/cli.js +0 -110
  400. package/src/lib/resources/templates/web-app/template/.eslintrc.cjs +0 -20
  401. package/src/lib/resources/templates/web-app/template/README.md +0 -151
  402. package/src/lib/resources/templates/web-app/template/index.html +0 -14
  403. package/src/lib/resources/templates/web-app/template/package.json +0 -44
  404. package/src/lib/resources/templates/web-app/template/postcss.config.js +0 -6
  405. package/src/lib/resources/templates/web-app/template/public/vite.svg +0 -1
  406. package/src/lib/resources/templates/web-app/template/src/App.tsx +0 -21
  407. package/src/lib/resources/templates/web-app/template/src/components/Layout.tsx +0 -57
  408. package/src/lib/resources/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +0 -107
  409. package/src/lib/resources/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +0 -71
  410. package/src/lib/resources/templates/web-app/template/src/index.css +0 -60
  411. package/src/lib/resources/templates/web-app/template/src/main.tsx +0 -10
  412. package/src/lib/resources/templates/web-app/template/src/pages/AiwfDashboard.tsx +0 -57
  413. package/src/lib/resources/templates/web-app/template/src/pages/HomePage.tsx +0 -89
  414. package/src/lib/resources/templates/web-app/template/src/pages/NotFound.tsx +0 -25
  415. package/src/lib/resources/templates/web-app/template/src/stores/aiwfStore.ts +0 -126
  416. package/src/lib/resources/templates/web-app/template/src/types/global.d.ts +0 -9
  417. package/src/lib/resources/templates/web-app/template/src/vite-env.d.ts +0 -1
  418. package/src/lib/resources/templates/web-app/template/tailwind.config.js +0 -30
  419. package/src/lib/resources/templates/web-app/template/tsconfig.json +0 -37
  420. package/src/lib/resources/templates/web-app/template/tsconfig.node.json +0 -10
  421. package/src/lib/resources/templates/web-app/template/vite.config.ts +0 -23
  422. package/src/lib/resources/utils/background-monitor.js +0 -223
  423. package/src/lib/resources/utils/compression-metrics.js +0 -1031
  424. package/src/lib/resources/utils/compression-strategies.js +0 -557
  425. package/src/lib/resources/utils/content-normalizer.js +0 -455
  426. package/src/lib/resources/utils/context-compressor.js +0 -583
  427. package/src/lib/resources/utils/context-rule-parser.js +0 -180
  428. package/src/lib/resources/utils/context-token-monitor.js +0 -463
  429. package/src/lib/resources/utils/context-update-manager.js +0 -502
  430. package/src/lib/resources/utils/git-utils.js +0 -220
  431. package/src/lib/resources/utils/importance-classifier.js +0 -645
  432. package/src/lib/resources/utils/information-filter.js +0 -710
  433. package/src/lib/resources/utils/persona-aware-compressor.js +0 -598
  434. package/src/lib/resources/utils/prompt-injector.js +0 -242
  435. package/src/lib/resources/utils/simplified-evaluator.js +0 -119
  436. package/src/lib/resources/utils/text-summarizer.js +0 -492
  437. package/src/lib/resources/utils/token-counter.js +0 -177
  438. package/src/lib/resources/utils/token-monitor.js +0 -484
  439. package/src/lib/resources/utils/token-reporter.js +0 -452
  440. package/src/lib/resources/utils/token-storage.js +0 -433
  441. package/src/lib/resources/utils/token-tracker.js +0 -283
  442. package/src/lib/rollback-manager.js +0 -418
  443. package/src/lib/state/priority-calculator.js +0 -217
  444. package/src/lib/state/state-index.js +0 -155
  445. package/src/lib/state/task-scanner.js +0 -328
  446. package/src/lib/task-analyzer.js +0 -599
  447. package/src/lib/template-cache-system.js +0 -559
  448. package/src/lib/template-downloader.js +0 -467
  449. package/src/lib/template-version-manager.js +0 -491
  450. package/src/lib/token-optimizer.js +0 -517
  451. package/src/lib/validator.js +0 -376
  452. package/src/utils/checkpoint-manager.js +0 -435
  453. package/src/utils/engineering-guard.js +0 -399
  454. package/src/utils/language-utils.js +0 -331
  455. package/src/utils/messages.js +0 -166
  456. package/src/utils/paths.js +0 -112
@@ -1,1057 +0,0 @@
1
- # Data Analyst 페르소나 Knowledge Base
2
-
3
- ## 데이터 분석 도구 및 라이브러리
4
-
5
- ### Python 데이터 분석 스택
6
-
7
- #### Pandas 고급 기능
8
- ```python
9
- import pandas as pd
10
- import numpy as np
11
-
12
- # 1. 멀티 인덱싱
13
- df = pd.DataFrame({
14
- 'date': pd.date_range('2024-01-01', periods=100),
15
- 'category': np.random.choice(['A', 'B', 'C'], 100),
16
- 'subcategory': np.random.choice(['X', 'Y'], 100),
17
- 'value': np.random.randn(100),
18
- 'quantity': np.random.randint(1, 100, 100)
19
- })
20
-
21
- # 멀티 인덱스 생성
22
- df_multi = df.set_index(['category', 'subcategory'])
23
-
24
- # 멀티 인덱스 접근
25
- df_multi.loc[('A', 'X')] # 특정 조합
26
- df_multi.xs('X', level='subcategory') # 특정 레벨
27
-
28
- # 2. Window Functions
29
- # 이동 평균
30
- df['ma_7'] = df.groupby('category')['value'].transform(
31
- lambda x: x.rolling(7, min_periods=1).mean()
32
- )
33
-
34
- # 누적 합계
35
- df['cumsum'] = df.groupby('category')['value'].cumsum()
36
-
37
- # Expanding window
38
- df['expanding_mean'] = df.groupby('category')['value'].expanding().mean()
39
-
40
- # 3. 피벗 테이블 고급 기능
41
- pivot_table = pd.pivot_table(
42
- df,
43
- values=['value', 'quantity'],
44
- index=['date'],
45
- columns=['category'],
46
- aggfunc={
47
- 'value': ['mean', 'std'],
48
- 'quantity': 'sum'
49
- },
50
- fill_value=0,
51
- margins=True,
52
- margins_name='Total'
53
- )
54
-
55
- # 4. 시계열 리샘플링
56
- df_ts = df.set_index('date')
57
- monthly_summary = df_ts.resample('M').agg({
58
- 'value': ['sum', 'mean', 'std'],
59
- 'quantity': 'sum'
60
- })
61
-
62
- # 5. 메모리 최적화
63
- def optimize_dataframe(df):
64
- """데이터프레임 메모리 사용량 최적화"""
65
- for col in df.columns:
66
- col_type = df[col].dtype
67
-
68
- if col_type != 'object':
69
- c_min = df[col].min()
70
- c_max = df[col].max()
71
-
72
- if str(col_type)[:3] == 'int':
73
- if c_min > np.iinfo(np.int8).min and c_max < np.iinfo(np.int8).max:
74
- df[col] = df[col].astype(np.int8)
75
- elif c_min > np.iinfo(np.int16).min and c_max < np.iinfo(np.int16).max:
76
- df[col] = df[col].astype(np.int16)
77
- elif c_min > np.iinfo(np.int32).min and c_max < np.iinfo(np.int32).max:
78
- df[col] = df[col].astype(np.int32)
79
- else:
80
- if c_min > np.finfo(np.float16).min and c_max < np.finfo(np.float16).max:
81
- df[col] = df[col].astype(np.float16)
82
- elif c_min > np.finfo(np.float32).min and c_max < np.finfo(np.float32).max:
83
- df[col] = df[col].astype(np.float32)
84
- else:
85
- df[col] = df[col].astype('category')
86
-
87
- return df
88
- ```
89
-
90
- #### NumPy 고급 연산
91
- ```python
92
- # 1. Broadcasting
93
- a = np.array([[1, 2, 3], [4, 5, 6]])
94
- b = np.array([10, 20, 30])
95
- result = a + b # Broadcasting 적용
96
-
97
- # 2. 벡터화 연산
98
- @np.vectorize
99
- def custom_function(x):
100
- if x > 0:
101
- return np.log(x)
102
- else:
103
- return 0
104
-
105
- vectorized_result = custom_function(np.array([-1, 0, 1, 2, 3]))
106
-
107
- # 3. 고급 인덱싱
108
- arr = np.random.randn(10, 10)
109
- mask = arr > 0
110
- positive_values = arr[mask]
111
-
112
- # Fancy indexing
113
- rows = np.array([0, 2, 4])
114
- cols = np.array([1, 3, 5])
115
- selected = arr[rows[:, np.newaxis], cols]
116
-
117
- # 4. 선형대수 연산
118
- # 고유값 분해
119
- eigenvalues, eigenvectors = np.linalg.eig(arr)
120
-
121
- # 특이값 분해 (SVD)
122
- U, s, Vt = np.linalg.svd(arr)
123
-
124
- # 5. 통계 함수
125
- # 백분위수
126
- percentiles = np.percentile(arr, [25, 50, 75], axis=0)
127
-
128
- # 상관계수 행렬
129
- correlation_matrix = np.corrcoef(arr.T)
130
- ```
131
-
132
- ### SQL 고급 쿼리
133
-
134
- #### 윈도우 함수
135
- ```sql
136
- -- 1. 순위 함수
137
- WITH sales_ranking AS (
138
- SELECT
139
- product_id,
140
- sale_date,
141
- amount,
142
- ROW_NUMBER() OVER (PARTITION BY product_id ORDER BY amount DESC) as row_num,
143
- RANK() OVER (PARTITION BY product_id ORDER BY amount DESC) as rank,
144
- DENSE_RANK() OVER (PARTITION BY product_id ORDER BY amount DESC) as dense_rank,
145
- PERCENT_RANK() OVER (PARTITION BY product_id ORDER BY amount DESC) as percent_rank
146
- FROM sales
147
- )
148
- SELECT * FROM sales_ranking WHERE row_num <= 10;
149
-
150
- -- 2. 이동 평균 및 누적 합계
151
- SELECT
152
- date,
153
- revenue,
154
- -- 7일 이동 평균
155
- AVG(revenue) OVER (
156
- ORDER BY date
157
- ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
158
- ) as ma_7,
159
- -- 누적 합계
160
- SUM(revenue) OVER (
161
- ORDER BY date
162
- ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
163
- ) as cumulative_revenue,
164
- -- 전월 대비 성장률
165
- LAG(revenue, 1) OVER (ORDER BY date) as prev_revenue,
166
- (revenue - LAG(revenue, 1) OVER (ORDER BY date)) /
167
- NULLIF(LAG(revenue, 1) OVER (ORDER BY date), 0) * 100 as growth_rate
168
- FROM daily_revenue;
169
-
170
- -- 3. 고급 집계
171
- WITH monthly_stats AS (
172
- SELECT
173
- DATE_TRUNC('month', order_date) as month,
174
- category,
175
- COUNT(DISTINCT customer_id) as unique_customers,
176
- COUNT(*) as total_orders,
177
- SUM(amount) as total_revenue,
178
- AVG(amount) as avg_order_value,
179
- STDDEV(amount) as stddev_order_value
180
- FROM orders
181
- GROUP BY DATE_TRUNC('month', order_date), category
182
- ),
183
- category_percentiles AS (
184
- SELECT
185
- month,
186
- category,
187
- total_revenue,
188
- PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY total_revenue)
189
- OVER (PARTITION BY month) as q1,
190
- PERCENTILE_CONT(0.50) WITHIN GROUP (ORDER BY total_revenue)
191
- OVER (PARTITION BY month) as median,
192
- PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY total_revenue)
193
- OVER (PARTITION BY month) as q3
194
- FROM monthly_stats
195
- )
196
- SELECT * FROM category_percentiles;
197
-
198
- -- 4. 재귀 CTE (계층 구조)
199
- WITH RECURSIVE category_hierarchy AS (
200
- -- Base case
201
- SELECT
202
- id,
203
- name,
204
- parent_id,
205
- 0 as level,
206
- name as path
207
- FROM categories
208
- WHERE parent_id IS NULL
209
-
210
- UNION ALL
211
-
212
- -- Recursive case
213
- SELECT
214
- c.id,
215
- c.name,
216
- c.parent_id,
217
- ch.level + 1,
218
- ch.path || ' > ' || c.name
219
- FROM categories c
220
- JOIN category_hierarchy ch ON c.parent_id = ch.id
221
- )
222
- SELECT * FROM category_hierarchy ORDER BY path;
223
- ```
224
-
225
- ### 통계 분석 기법
226
-
227
- #### 가설 검정
228
- ```python
229
- from scipy import stats
230
- import statsmodels.api as sm
231
- from statsmodels.stats.multicomp import pairwise_tukeyhsd
232
-
233
- class StatisticalTesting:
234
- @staticmethod
235
- def normality_tests(data):
236
- """정규성 검정"""
237
- results = {}
238
-
239
- # Shapiro-Wilk test
240
- stat, p_value = stats.shapiro(data)
241
- results['shapiro'] = {
242
- 'statistic': stat,
243
- 'p_value': p_value,
244
- 'is_normal': p_value > 0.05
245
- }
246
-
247
- # Kolmogorov-Smirnov test
248
- stat, p_value = stats.kstest(data, 'norm',
249
- args=(data.mean(), data.std()))
250
- results['ks_test'] = {
251
- 'statistic': stat,
252
- 'p_value': p_value,
253
- 'is_normal': p_value > 0.05
254
- }
255
-
256
- # Anderson-Darling test
257
- result = stats.anderson(data)
258
- results['anderson'] = {
259
- 'statistic': result.statistic,
260
- 'critical_values': result.critical_values,
261
- 'significance_levels': result.significance_level
262
- }
263
-
264
- return results
265
-
266
- @staticmethod
267
- def variance_tests(group1, group2):
268
- """등분산성 검정"""
269
- # Levene's test
270
- stat, p_value = stats.levene(group1, group2)
271
-
272
- return {
273
- 'levene': {
274
- 'statistic': stat,
275
- 'p_value': p_value,
276
- 'equal_variance': p_value > 0.05
277
- }
278
- }
279
-
280
- @staticmethod
281
- def anova_analysis(groups, labels):
282
- """ANOVA 분석"""
283
- # One-way ANOVA
284
- f_stat, p_value = stats.f_oneway(*groups)
285
-
286
- # Post-hoc test (Tukey HSD)
287
- data_combined = np.concatenate(groups)
288
- labels_combined = np.concatenate([
289
- [label] * len(group)
290
- for label, group in zip(labels, groups)
291
- ])
292
-
293
- tukey_result = pairwise_tukeyhsd(
294
- data_combined,
295
- labels_combined,
296
- alpha=0.05
297
- )
298
-
299
- return {
300
- 'anova': {
301
- 'f_statistic': f_stat,
302
- 'p_value': p_value,
303
- 'significant': p_value < 0.05
304
- },
305
- 'post_hoc': str(tukey_result)
306
- }
307
- ```
308
-
309
- #### 회귀 분석
310
- ```python
311
- class RegressionAnalysis:
312
- def __init__(self, X, y):
313
- self.X = X
314
- self.y = y
315
- self.model = None
316
- self.results = None
317
-
318
- def linear_regression(self):
319
- """선형 회귀 분석"""
320
- # 상수항 추가
321
- X_with_const = sm.add_constant(self.X)
322
-
323
- # 모델 적합
324
- self.model = sm.OLS(self.y, X_with_const)
325
- self.results = self.model.fit()
326
-
327
- # 결과 요약
328
- summary = {
329
- 'r_squared': self.results.rsquared,
330
- 'adj_r_squared': self.results.rsquared_adj,
331
- 'f_statistic': self.results.fvalue,
332
- 'f_pvalue': self.results.f_pvalue,
333
- 'coefficients': dict(zip(
334
- self.X.columns,
335
- self.results.params[1:]
336
- )),
337
- 'p_values': dict(zip(
338
- self.X.columns,
339
- self.results.pvalues[1:]
340
- )),
341
- 'confidence_intervals': self.results.conf_int()[1:].values.tolist()
342
- }
343
-
344
- return summary
345
-
346
- def check_assumptions(self):
347
- """회귀 가정 검증"""
348
- residuals = self.results.resid
349
- fitted = self.results.fittedvalues
350
-
351
- # 1. 선형성 검정
352
- linearity_test = stats.pearsonr(fitted, self.y)[1] < 0.05
353
-
354
- # 2. 정규성 검정
355
- _, normality_pvalue = stats.jarque_bera(residuals)
356
-
357
- # 3. 등분산성 검정 (Breusch-Pagan test)
358
- bp_test = sm.stats.diagnostic.het_breuschpagan(
359
- residuals, self.results.model.exog
360
- )
361
-
362
- # 4. 자기상관 검정 (Durbin-Watson)
363
- dw_stat = sm.stats.stattools.durbin_watson(residuals)
364
-
365
- # 5. 다중공선성 (VIF)
366
- from statsmodels.stats.outliers_influence import variance_inflation_factor
367
-
368
- vif_data = pd.DataFrame()
369
- vif_data["Variable"] = self.X.columns
370
- vif_data["VIF"] = [
371
- variance_inflation_factor(self.X.values, i)
372
- for i in range(self.X.shape[1])
373
- ]
374
-
375
- return {
376
- 'linearity': linearity_test,
377
- 'normality': normality_pvalue > 0.05,
378
- 'homoscedasticity': bp_test[1] > 0.05,
379
- 'autocorrelation': 1.5 < dw_stat < 2.5,
380
- 'multicollinearity': vif_data.to_dict()
381
- }
382
- ```
383
-
384
- ### 시계열 분석
385
-
386
- #### 시계열 분해 및 예측
387
- ```python
388
- from statsmodels.tsa.seasonal import seasonal_decompose
389
- from statsmodels.tsa.stattools import adfuller, kpss
390
- from statsmodels.tsa.arima.model import ARIMA
391
- from prophet import Prophet
392
-
393
- class TimeSeriesAnalysis:
394
- def __init__(self, ts_data, date_col, value_col):
395
- self.data = ts_data.set_index(date_col)[value_col].sort_index()
396
- self.decomposition = None
397
-
398
- def test_stationarity(self):
399
- """정상성 검정"""
400
- # ADF Test
401
- adf_result = adfuller(self.data, autolag='AIC')
402
-
403
- # KPSS Test
404
- kpss_result = kpss(self.data, regression='c', nlags='auto')
405
-
406
- return {
407
- 'adf': {
408
- 'statistic': adf_result[0],
409
- 'p_value': adf_result[1],
410
- 'is_stationary': adf_result[1] < 0.05
411
- },
412
- 'kpss': {
413
- 'statistic': kpss_result[0],
414
- 'p_value': kpss_result[1],
415
- 'is_stationary': kpss_result[1] > 0.05
416
- }
417
- }
418
-
419
- def decompose_series(self, model='additive', period=None):
420
- """시계열 분해"""
421
- self.decomposition = seasonal_decompose(
422
- self.data,
423
- model=model,
424
- period=period,
425
- extrapolate_trend='freq'
426
- )
427
-
428
- return {
429
- 'trend': self.decomposition.trend,
430
- 'seasonal': self.decomposition.seasonal,
431
- 'residual': self.decomposition.resid
432
- }
433
-
434
- def fit_arima(self, order=(1,1,1), seasonal_order=(0,0,0,0)):
435
- """ARIMA 모델 적합"""
436
- model = ARIMA(self.data, order=order, seasonal_order=seasonal_order)
437
- fitted_model = model.fit()
438
-
439
- # 예측
440
- forecast = fitted_model.forecast(steps=30)
441
-
442
- return {
443
- 'model': fitted_model,
444
- 'aic': fitted_model.aic,
445
- 'bic': fitted_model.bic,
446
- 'forecast': forecast,
447
- 'summary': fitted_model.summary()
448
- }
449
-
450
- def prophet_forecast(self, periods=30):
451
- """Prophet 예측"""
452
- # 데이터 준비
453
- prophet_data = pd.DataFrame({
454
- 'ds': self.data.index,
455
- 'y': self.data.values
456
- })
457
-
458
- # 모델 생성 및 학습
459
- model = Prophet(
460
- yearly_seasonality=True,
461
- weekly_seasonality=True,
462
- daily_seasonality=False,
463
- changepoint_prior_scale=0.05
464
- )
465
-
466
- model.fit(prophet_data)
467
-
468
- # 예측
469
- future = model.make_future_dataframe(periods=periods)
470
- forecast = model.predict(future)
471
-
472
- return {
473
- 'model': model,
474
- 'forecast': forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']],
475
- 'components': model.plot_components(forecast)
476
- }
477
- ```
478
-
479
- ### 머신러닝 기법
480
-
481
- #### 특성 공학
482
- ```python
483
- from sklearn.preprocessing import PolynomialFeatures, StandardScaler
484
- from sklearn.feature_selection import SelectKBest, f_classif, RFE
485
- from sklearn.decomposition import PCA
486
-
487
- class FeatureEngineering:
488
- def __init__(self, X, y):
489
- self.X = X
490
- self.y = y
491
-
492
- def create_polynomial_features(self, degree=2):
493
- """다항 특성 생성"""
494
- poly = PolynomialFeatures(degree=degree, include_bias=False)
495
- X_poly = poly.fit_transform(self.X)
496
-
497
- feature_names = poly.get_feature_names_out(self.X.columns)
498
-
499
- return pd.DataFrame(X_poly, columns=feature_names, index=self.X.index)
500
-
501
- def create_interaction_features(self):
502
- """상호작용 특성 생성"""
503
- interactions = pd.DataFrame(index=self.X.index)
504
-
505
- for i, col1 in enumerate(self.X.columns):
506
- for col2 in self.X.columns[i+1:]:
507
- # 곱셈 상호작용
508
- interactions[f'{col1}_x_{col2}'] = self.X[col1] * self.X[col2]
509
-
510
- # 나눗셈 상호작용 (0 방지)
511
- denominator = self.X[col2].replace(0, np.nan)
512
- interactions[f'{col1}_div_{col2}'] = self.X[col1] / denominator
513
-
514
- return interactions
515
-
516
- def create_lag_features(self, n_lags=3):
517
- """시차 특성 생성"""
518
- lag_features = pd.DataFrame(index=self.X.index)
519
-
520
- for col in self.X.columns:
521
- for lag in range(1, n_lags + 1):
522
- lag_features[f'{col}_lag{lag}'] = self.X[col].shift(lag)
523
-
524
- return lag_features
525
-
526
- def select_features(self, method='univariate', n_features=10):
527
- """특성 선택"""
528
- if method == 'univariate':
529
- # Univariate selection
530
- selector = SelectKBest(score_func=f_classif, k=n_features)
531
- selector.fit(self.X, self.y)
532
-
533
- selected_features = self.X.columns[selector.get_support()]
534
- scores = pd.DataFrame({
535
- 'feature': self.X.columns,
536
- 'score': selector.scores_
537
- }).sort_values('score', ascending=False)
538
-
539
- elif method == 'rfe':
540
- # Recursive Feature Elimination
541
- from sklearn.ensemble import RandomForestClassifier
542
-
543
- estimator = RandomForestClassifier(n_estimators=100, random_state=42)
544
- selector = RFE(estimator, n_features_to_select=n_features)
545
- selector.fit(self.X, self.y)
546
-
547
- selected_features = self.X.columns[selector.support_]
548
- scores = pd.DataFrame({
549
- 'feature': self.X.columns,
550
- 'ranking': selector.ranking_
551
- }).sort_values('ranking')
552
-
553
- return selected_features, scores
554
-
555
- def dimensionality_reduction(self, n_components=0.95):
556
- """차원 축소"""
557
- # 표준화
558
- scaler = StandardScaler()
559
- X_scaled = scaler.fit_transform(self.X)
560
-
561
- # PCA
562
- pca = PCA(n_components=n_components)
563
- X_pca = pca.fit_transform(X_scaled)
564
-
565
- # 주성분 기여도
566
- component_importance = pd.DataFrame({
567
- 'component': [f'PC{i+1}' for i in range(len(pca.components_))],
568
- 'explained_variance_ratio': pca.explained_variance_ratio_,
569
- 'cumulative_variance_ratio': np.cumsum(pca.explained_variance_ratio_)
570
- })
571
-
572
- # 특성 중요도
573
- feature_importance = pd.DataFrame(
574
- pca.components_.T,
575
- columns=[f'PC{i+1}' for i in range(len(pca.components_))],
576
- index=self.X.columns
577
- )
578
-
579
- return {
580
- 'transformed_data': X_pca,
581
- 'component_importance': component_importance,
582
- 'feature_importance': feature_importance,
583
- 'n_components': pca.n_components_
584
- }
585
- ```
586
-
587
- #### 클러스터링 분석
588
- ```python
589
- from sklearn.cluster import KMeans, DBSCAN, AgglomerativeClustering
590
- from sklearn.metrics import silhouette_score, calinski_harabasz_score
591
-
592
- class ClusteringAnalysis:
593
- def __init__(self, X):
594
- self.X = X
595
- self.scaler = StandardScaler()
596
- self.X_scaled = self.scaler.fit_transform(X)
597
-
598
- def find_optimal_clusters(self, max_k=10):
599
- """최적 클러스터 수 찾기"""
600
- metrics = {
601
- 'k': [],
602
- 'inertia': [],
603
- 'silhouette': [],
604
- 'calinski_harabasz': []
605
- }
606
-
607
- for k in range(2, max_k + 1):
608
- kmeans = KMeans(n_clusters=k, random_state=42)
609
- labels = kmeans.fit_predict(self.X_scaled)
610
-
611
- metrics['k'].append(k)
612
- metrics['inertia'].append(kmeans.inertia_)
613
- metrics['silhouette'].append(silhouette_score(self.X_scaled, labels))
614
- metrics['calinski_harabasz'].append(
615
- calinski_harabasz_score(self.X_scaled, labels)
616
- )
617
-
618
- # Elbow method
619
- differences = np.diff(metrics['inertia'])
620
- elbow_point = np.argmax(differences[1:] - differences[:-1]) + 2
621
-
622
- return pd.DataFrame(metrics), elbow_point
623
-
624
- def perform_clustering(self, method='kmeans', **params):
625
- """클러스터링 수행"""
626
- if method == 'kmeans':
627
- model = KMeans(**params)
628
- elif method == 'dbscan':
629
- model = DBSCAN(**params)
630
- elif method == 'hierarchical':
631
- model = AgglomerativeClustering(**params)
632
-
633
- labels = model.fit_predict(self.X_scaled)
634
-
635
- # 클러스터 프로파일
636
- cluster_profiles = []
637
- for cluster in np.unique(labels):
638
- if cluster != -1: # DBSCAN의 noise points 제외
639
- cluster_mask = labels == cluster
640
- profile = {
641
- 'cluster': cluster,
642
- 'size': np.sum(cluster_mask),
643
- 'percentage': np.sum(cluster_mask) / len(labels) * 100
644
- }
645
-
646
- # 각 특성의 평균값
647
- for col in self.X.columns:
648
- profile[f'{col}_mean'] = self.X.loc[cluster_mask, col].mean()
649
- profile[f'{col}_std'] = self.X.loc[cluster_mask, col].std()
650
-
651
- cluster_profiles.append(profile)
652
-
653
- return {
654
- 'labels': labels,
655
- 'model': model,
656
- 'profiles': pd.DataFrame(cluster_profiles),
657
- 'silhouette_score': silhouette_score(self.X_scaled, labels)
658
- if len(np.unique(labels)) > 1 else None
659
- }
660
- ```
661
-
662
- ### 데이터 시각화 고급 기법
663
-
664
- #### 고급 시각화 패턴
665
- ```python
666
- import matplotlib.pyplot as plt
667
- import seaborn as sns
668
- from matplotlib.patches import Rectangle
669
- import matplotlib.patches as mpatches
670
-
671
- class AdvancedVisualization:
672
- def __init__(self, style='seaborn'):
673
- plt.style.use(style)
674
- self.colors = sns.color_palette('husl', 10)
675
-
676
- def create_waterfall_chart(self, categories, values, title="Waterfall Chart"):
677
- """워터폴 차트"""
678
- fig, ax = plt.subplots(figsize=(12, 8))
679
-
680
- # 누적 계산
681
- cumulative = np.cumsum(values)
682
- cumulative = np.concatenate([[0], cumulative])
683
-
684
- # 막대 그리기
685
- for i, (cat, val) in enumerate(zip(categories, values)):
686
- if val >= 0:
687
- color = 'green'
688
- bottom = cumulative[i]
689
- else:
690
- color = 'red'
691
- bottom = cumulative[i+1]
692
-
693
- ax.bar(i, abs(val), bottom=bottom, color=color,
694
- edgecolor='black', linewidth=1)
695
-
696
- # 값 표시
697
- ax.text(i, bottom + abs(val)/2, f'{val:,.0f}',
698
- ha='center', va='center', fontweight='bold')
699
-
700
- # 연결선
701
- for i in range(len(categories)):
702
- if i < len(categories) - 1:
703
- ax.plot([i+0.4, i+0.6], [cumulative[i+1], cumulative[i+1]],
704
- 'k--', alpha=0.5)
705
-
706
- ax.set_xticks(range(len(categories)))
707
- ax.set_xticklabels(categories, rotation=45, ha='right')
708
- ax.set_title(title, fontsize=16, fontweight='bold')
709
- ax.set_ylabel('Value', fontsize=14)
710
-
711
- # 그리드
712
- ax.yaxis.grid(True, alpha=0.3)
713
- ax.set_axisbelow(True)
714
-
715
- plt.tight_layout()
716
- return fig
717
-
718
- def create_bullet_chart(self, value, target, ranges, title=""):
719
- """불릿 차트"""
720
- fig, ax = plt.subplots(figsize=(8, 3))
721
-
722
- # 범위 그리기
723
- colors = ['#d3d3d3', '#a9a9a9', '#808080']
724
- for i, (start, end) in enumerate(ranges):
725
- ax.barh(0, end - start, left=start, height=1,
726
- color=colors[i], alpha=0.5)
727
-
728
- # 실제 값
729
- ax.barh(0, value, height=0.5, color='black')
730
-
731
- # 목표 값
732
- ax.plot([target, target], [-0.6, 0.6], 'r-', linewidth=3)
733
-
734
- ax.set_xlim(0, max(ranges[-1][1], value, target) * 1.1)
735
- ax.set_ylim(-1, 1)
736
- ax.set_yticks([])
737
- ax.set_title(title, fontsize=14, fontweight='bold')
738
-
739
- # 레이블
740
- ax.text(value/2, 0, f'{value:,.0f}',
741
- ha='center', va='center', color='white', fontweight='bold')
742
- ax.text(target, -0.8, f'Target: {target:,.0f}',
743
- ha='center', fontsize=10)
744
-
745
- return fig
746
-
747
- def create_sankey_diagram(self, source, target, value, labels):
748
- """생키 다이어그램"""
749
- import plotly.graph_objects as go
750
-
751
- # 노드 인덱스 매핑
752
- all_nodes = list(set(source + target))
753
- node_indices = {node: i for i, node in enumerate(all_nodes)}
754
-
755
- source_indices = [node_indices[s] for s in source]
756
- target_indices = [node_indices[t] for t in target]
757
-
758
- fig = go.Figure(data=[go.Sankey(
759
- node=dict(
760
- pad=15,
761
- thickness=20,
762
- line=dict(color="black", width=0.5),
763
- label=all_nodes,
764
- color="blue"
765
- ),
766
- link=dict(
767
- source=source_indices,
768
- target=target_indices,
769
- value=value,
770
- color="rgba(0,0,255,0.4)"
771
- )
772
- )])
773
-
774
- fig.update_layout(
775
- title_text="Sankey Diagram",
776
- font_size=10,
777
- height=600
778
- )
779
-
780
- return fig
781
-
782
- def create_radar_chart(self, categories, values_dict, title="Radar Chart"):
783
- """레이더 차트 (여러 그룹 비교)"""
784
- angles = np.linspace(0, 2 * np.pi, len(categories), endpoint=False).tolist()
785
- angles += angles[:1]
786
-
787
- fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(projection='polar'))
788
-
789
- for label, values in values_dict.items():
790
- values = values.tolist()
791
- values += values[:1]
792
- ax.plot(angles, values, 'o-', linewidth=2, label=label)
793
- ax.fill(angles, values, alpha=0.25)
794
-
795
- ax.set_theta_offset(np.pi / 2)
796
- ax.set_theta_direction(-1)
797
- ax.set_thetagrids(np.degrees(angles[:-1]), categories)
798
-
799
- ax.set_ylim(0, max([max(v) for v in values_dict.values()]) * 1.1)
800
- ax.set_title(title, fontsize=16, fontweight='bold', pad=20)
801
- ax.legend(loc='upper right', bbox_to_anchor=(1.3, 1.0))
802
-
803
- return fig
804
- ```
805
-
806
- ### 리포트 자동화
807
-
808
- #### 자동 리포트 생성 시스템
809
- ```python
810
- from datetime import datetime
811
- import matplotlib.pyplot as plt
812
- from matplotlib.backends.backend_pdf import PdfPages
813
- import markdown
814
- from weasyprint import HTML, CSS
815
-
816
- class AutomatedReportGenerator:
817
- def __init__(self, template_engine='jinja2'):
818
- self.template_engine = template_engine
819
- self.sections = []
820
-
821
- def add_section(self, title, content, section_type='text'):
822
- """섹션 추가"""
823
- self.sections.append({
824
- 'title': title,
825
- 'content': content,
826
- 'type': section_type,
827
- 'timestamp': datetime.now()
828
- })
829
-
830
- def generate_pdf_report(self, filename='report.pdf'):
831
- """PDF 리포트 생성"""
832
- with PdfPages(filename) as pdf:
833
- # 표지 페이지
834
- self._create_cover_page(pdf)
835
-
836
- # 목차
837
- self._create_table_of_contents(pdf)
838
-
839
- # 섹션별 내용
840
- for i, section in enumerate(self.sections):
841
- if section['type'] == 'text':
842
- self._add_text_page(pdf, section)
843
- elif section['type'] == 'chart':
844
- self._add_chart_page(pdf, section)
845
- elif section['type'] == 'table':
846
- self._add_table_page(pdf, section)
847
-
848
- # 메타데이터
849
- d = pdf.infodict()
850
- d['Title'] = 'Automated Data Analysis Report'
851
- d['Author'] = 'Data Analysis System'
852
- d['Subject'] = 'Data Analysis'
853
- d['Keywords'] = 'Data, Analysis, Report'
854
- d['CreationDate'] = datetime.now()
855
-
856
- def _create_cover_page(self, pdf):
857
- """표지 페이지 생성"""
858
- fig = plt.figure(figsize=(8.5, 11))
859
- fig.text(0.5, 0.6, 'Data Analysis Report',
860
- ha='center', va='center', fontsize=24, fontweight='bold')
861
- fig.text(0.5, 0.5, f'Generated on {datetime.now().strftime("%Y-%m-%d")}',
862
- ha='center', va='center', fontsize=16)
863
- fig.text(0.5, 0.2, 'Automated Report Generation System',
864
- ha='center', va='center', fontsize=12, style='italic')
865
- pdf.savefig(fig, bbox_inches='tight')
866
- plt.close()
867
-
868
- def generate_html_report(self, filename='report.html'):
869
- """HTML 리포트 생성"""
870
- html_template = """
871
- <!DOCTYPE html>
872
- <html>
873
- <head>
874
- <meta charset="utf-8">
875
- <title>Data Analysis Report</title>
876
- <style>
877
- body {{ font-family: Arial, sans-serif; margin: 40px; }}
878
- h1 {{ color: #333; border-bottom: 2px solid #333; }}
879
- h2 {{ color: #666; }}
880
- .chart {{ margin: 20px 0; text-align: center; }}
881
- .table {{ margin: 20px 0; }}
882
- table {{ border-collapse: collapse; width: 100%; }}
883
- th, td {{ border: 1px solid #ddd; padding: 8px; text-align: left; }}
884
- th {{ background-color: #f2f2f2; font-weight: bold; }}
885
- .summary-box {{
886
- background-color: #f0f0f0;
887
- padding: 15px;
888
- border-radius: 5px;
889
- margin: 20px 0;
890
- }}
891
- .metric {{
892
- display: inline-block;
893
- margin: 10px 20px;
894
- text-align: center;
895
- }}
896
- .metric-value {{
897
- font-size: 24px;
898
- font-weight: bold;
899
- color: #2c3e50;
900
- }}
901
- .metric-label {{
902
- font-size: 14px;
903
- color: #7f8c8d;
904
- }}
905
- </style>
906
- </head>
907
- <body>
908
- <h1>Data Analysis Report</h1>
909
- <p>Generated on: {date}</p>
910
-
911
- {content}
912
- </body>
913
- </html>
914
- """
915
-
916
- content = self._generate_html_content()
917
- html = html_template.format(
918
- date=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
919
- content=content
920
- )
921
-
922
- with open(filename, 'w', encoding='utf-8') as f:
923
- f.write(html)
924
-
925
- def _generate_html_content(self):
926
- """HTML 콘텐츠 생성"""
927
- content_parts = []
928
-
929
- for section in self.sections:
930
- if section['type'] == 'text':
931
- content_parts.append(f"<h2>{section['title']}</h2>")
932
- content_parts.append(f"<p>{section['content']}</p>")
933
-
934
- elif section['type'] == 'metrics':
935
- content_parts.append(f"<h2>{section['title']}</h2>")
936
- content_parts.append('<div class="summary-box">')
937
-
938
- for metric, value in section['content'].items():
939
- content_parts.append(f'''
940
- <div class="metric">
941
- <div class="metric-value">{value}</div>
942
- <div class="metric-label">{metric}</div>
943
- </div>
944
- ''')
945
-
946
- content_parts.append('</div>')
947
-
948
- elif section['type'] == 'table':
949
- content_parts.append(f"<h2>{section['title']}</h2>")
950
- content_parts.append('<div class="table">')
951
- content_parts.append(section['content'].to_html(index=False))
952
- content_parts.append('</div>')
953
-
954
- return '\n'.join(content_parts)
955
- ```
956
-
957
- ### 비즈니스 인텔리전스
958
-
959
- #### KPI 대시보드
960
- ```python
961
- class KPIDashboard:
962
- def __init__(self, data):
963
- self.data = data
964
- self.kpis = {}
965
-
966
- def calculate_kpis(self):
967
- """주요 KPI 계산"""
968
- self.kpis = {
969
- 'revenue': {
970
- 'current': self.data['revenue'].sum(),
971
- 'previous': self.data['revenue_prev'].sum(),
972
- 'growth': self._calculate_growth('revenue', 'revenue_prev'),
973
- 'target': self.data['revenue_target'].sum()
974
- },
975
- 'customers': {
976
- 'total': self.data['customer_id'].nunique(),
977
- 'new': self.data[self.data['is_new_customer']]['customer_id'].nunique(),
978
- 'retention_rate': self._calculate_retention_rate(),
979
- 'churn_rate': self._calculate_churn_rate()
980
- },
981
- 'operations': {
982
- 'avg_order_value': self.data['revenue'].mean(),
983
- 'conversion_rate': self._calculate_conversion_rate(),
984
- 'fulfillment_time': self.data['fulfillment_hours'].mean()
985
- }
986
- }
987
-
988
- def _calculate_growth(self, current_col, previous_col):
989
- """성장률 계산"""
990
- current = self.data[current_col].sum()
991
- previous = self.data[previous_col].sum()
992
-
993
- if previous == 0:
994
- return float('inf')
995
-
996
- return ((current - previous) / previous) * 100
997
-
998
- def create_scorecard(self):
999
- """스코어카드 생성"""
1000
- fig, axes = plt.subplots(2, 3, figsize=(15, 10))
1001
- axes = axes.flatten()
1002
-
1003
- # Revenue KPI
1004
- self._create_kpi_widget(
1005
- axes[0],
1006
- 'Revenue',
1007
- self.kpis['revenue']['current'],
1008
- self.kpis['revenue']['growth'],
1009
- self.kpis['revenue']['target']
1010
- )
1011
-
1012
- # Customer KPIs
1013
- self._create_kpi_widget(
1014
- axes[1],
1015
- 'Total Customers',
1016
- self.kpis['customers']['total'],
1017
- self.kpis['customers']['new'],
1018
- None
1019
- )
1020
-
1021
- # Retention Rate
1022
- self._create_gauge_chart(
1023
- axes[2],
1024
- 'Retention Rate',
1025
- self.kpis['customers']['retention_rate'],
1026
- [0, 100]
1027
- )
1028
-
1029
- # Continue with other KPIs...
1030
-
1031
- plt.tight_layout()
1032
- return fig
1033
-
1034
- def _create_kpi_widget(self, ax, title, value, change, target=None):
1035
- """KPI 위젯 생성"""
1036
- ax.set_xlim(0, 1)
1037
- ax.set_ylim(0, 1)
1038
- ax.axis('off')
1039
-
1040
- # 제목
1041
- ax.text(0.5, 0.9, title, ha='center', fontsize=14, fontweight='bold')
1042
-
1043
- # 값
1044
- ax.text(0.5, 0.6, f'{value:,.0f}', ha='center', fontsize=24, fontweight='bold')
1045
-
1046
- # 변화율
1047
- color = 'green' if change >= 0 else 'red'
1048
- arrow = '▲' if change >= 0 else '▼'
1049
- ax.text(0.5, 0.4, f'{arrow} {abs(change):.1f}%',
1050
- ha='center', fontsize=16, color=color)
1051
-
1052
- # 목표
1053
- if target:
1054
- progress = (value / target) * 100
1055
- ax.text(0.5, 0.2, f'Target: {progress:.1f}%',
1056
- ha='center', fontsize=12, color='gray')
1057
- ```