Skip to content

marina554/Kakeibo-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Financial Statement Simulator

A Streamlit-based app that generates Balance Sheets and Profit/Loss statements from journal entries, with simple regression-based forecasting and anomaly detection. The goal is to provide a compact, self-contained tool for experimenting with accounting logic, data processing, and lightweight machine learning.

🎯 Purpose

This project started from the idea of combining accounting workflows and programming into one visual flow. Journal entries often scatter across spreadsheets or notes, so the app organizes them into a clean, interactive interface.

🧩 Main Features ■ 1. Journal Entry Input

Enter debit, credit, and amount

Automatically stored in session state

Default amount is standardized to 0

Account names are selected from dropdowns to reduce input errors

■ 2. Automatic Balance Sheet

Assets, Liabilities, and Equity are calculated from journal entries

Shows a warning when the left and right sides do not match

Layout styled with custom HTML/CSS for a more “statement-like” look

■ 3. Automatic Profit & Loss Statement

Revenue and expenses processed into a P/L table

Calculates gross profit, ordinary income, and net income

Clean table output for quick checks

■ 4. Simple Regression Forecasting

Creates basic predictions for each account

Uses the latest value as a simple forecast (easy to upgrade later)

Structure prepared for replacing with more advanced models

■ 5. Anomaly Detection

Uses IsolationForest to detect unusual account movements

Outputs -1 for outliers

Helpful for spotting unexpected or irregular entries

🖥️ How to Use

Run the app

streamlit run app.py

Enter a journal entry

Debit

Credit

Amount

Press Add to store the entry.

The Balance Sheet and P/L are automatically generated.

The bottom section shows:

Predicted P/L values

Anomaly detection results

🧠 What I Learned / Key Takeaways

Bridging accounting logic with code Translating the full flow—journal entries → account updates → financial statements—into executable logic was both challenging and rewarding.

Streamlit custom layout Adjusting HTML/CSS to make it look like real financial forms taught me how far Streamlit can be pushed visually.

Anomaly detection in small datasets Even with compact accounting data, ML models can still find meaningful irregularities.

End-to-end development experience Building UI, logic, data aggregation, and ML in one project strengthened the “full pipeline” mindset.

📦 Possible Future Improvements

Replace the simple predictor with a proper regression model

Add monthly trend graphs

Heatmaps for account behavior

AI-assisted journal entry suggestions

Import/export with CSV or Excel

📄 License

Add MIT License or any license as needed.


財務シミュレーター

仕訳入力から B/S・P/L を自動生成し、さらに簡易的な回帰予測と異常値検知まで行うアプリです。 Streamlit を使って動作する、単体で完結した財務分析ツールを目指して作りました。

🎯 目的

もともとは「会計処理とプログラミングをひとつにまとめて可視化したい」という動機から始まりました。 手作業だと散らばりやすい計算や集計を、自分で設計した UI の中に流れとしてまとめています。

🧩 主な機能 ■ 1. 仕訳入力

借方・貸方・金額を登録

自動でセッションに蓄積

デフォルト値は 0 円で統一

入力ミス防止のために科目はプルダウン選択

■ 2. 自動 B/S(企業風)

資産・負債・純資産を自動集計

合計が一致しない場合は警告を表示

テーブルは企業の帳票に近い見た目に調整

HTML + CSS でレイアウトをカスタム

■ 3. 自動 P/L

売上・費用・利益ラインを自動算出

売上総利益、経常利益、当期純利益まで計算

表示はテーブル形式

■ 4. 回帰予測(簡易)

各科目の履歴データから予測値を作成

今回はシンプルに「最新値 ≒ 予測値」というモデル

本格的なモデルに差し替え可能な構造にしてある

■ 5. 異常値検知

全勘定科目の金額を IsolationForest でスコアリング

-1 が異常値として出力

会計仕訳に“らしくない動き”があると一瞬でわかる

🖥️ 使い方

アプリを起動(例)

streamlit run app.py

仕訳入力フォームにデータを入れる

借方

貸方

金額

「追加」ボタンを押すとリストに反映される

ページ下部に自動で B/S と P/L が生成される

予測 P/L & 異常値

最新の値を使った予測

異常値の判定結果 がまとめて表示される

🧠 学んだこと・工夫した点

会計処理とプログラムをどう接続するか 仕訳 → 勘定科目の増減 → 財務諸表作成、という流れをコードで表現することの難しさと面白さ。

Streamlit のカスタム CSS 白いバーやレイアウト崩れと戦いながら、帳票として“それっぽく見える UI”を作る良い練習になった。

異常値検知の応用 会計データはシンプルに見えてアウトライヤーの判定と相性が良い。 小さなデータでもモデルが動くという安心感。

一つのアプリとして通しで設計する感覚 フロント(UI)、ロジック、データ集計、ML まで一貫して作れたのは大きな成果。

📦 今後の拡張案

予測ロジックに本格的な回帰モデルを導入

月次推移のグラフ化

科目ごとの推移ヒートマップ

“仕訳の自動推定”(AI入力補助)

CSV/Excel との連携

📄 ライセンス

MIT License など、必要に応じて記入してください。

About

Portfolio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages