diff --git a/.cursorrules b/.cursorrules index 4178698..6619b3f 100644 --- a/.cursorrules +++ b/.cursorrules @@ -3,3 +3,5 @@ - コーディング: 既存のコードスタイル・命名規則に従う - プロジェクト概要:クレジットカードCSVデータを分類、レポートを作るWebアプリケーション - 注意点(任意):仕様書の確認する +- /Doc/diary.md に、作業ログ記録 何をやったかを箇条書きでOK +- この端末にはpostgreのCLIがインストールされています 本体は https:labo.sunamura-llc.com に設置 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..bd7ffc4 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +DJANGO_SECRET_KEY=change-me +DJANGO_DEBUG=true +DATABASE_URL=postgresql://postgres:postgres@localhost:5432/card_data_sorting diff --git a/.gitignore b/.gitignore index 7297cad..d6766b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,178 +1,13 @@ -Sample-data/ - -# ---> Python -# Byte-compiled / optimized / DLL files -__pycache__/ *.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# UV -# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -#uv.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/latest/usage/project/#working-with-version-control -.pdm.toml -.pdm-python -.pdm-build/ - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments +*.swp +.DS_Store .env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ - -# Ruff stuff: -.ruff_cache/ - -# PyPI configuration file -.pypirc - +.venv/ +__pycache__/ +*.sqlite3 +*.log +/.pytest_cache/ +/.mypy_cache/ +/.ruff_cache/ +/staticfiles/ +/media/ diff --git a/Doc/diary.md b/Doc/diary.md new file mode 100644 index 0000000..f1199b5 --- /dev/null +++ b/Doc/diary.md @@ -0,0 +1 @@ +# 作業日誌 (作業ログです) \ No newline at end of file diff --git a/README.md b/README.md index c01d30c..2c233f7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ -# ------ +# Card-data-sorting -何某の元ネタとなる \ No newline at end of file +Business-focused Django app for importing credit card CSV statements and splitting business vs household expenses. + +## Development setup + +### Prerequisites + +- Python 3.9+ (local) +- PostgreSQL 14+ +- libffi/libpango/libcairo (for WeasyPrint) + +### Setup steps + +```bash +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements-dev.txt +cp .env.example .env +``` + +### Environment variables + +Edit `.env` to match your local DB. + +### Next actions + +- Initialize the Django project and app structure. +- Configure PostgreSQL settings and migrations. diff --git a/Sample-data/IDEMITSU_2512-2.csv b/Sample-data/IDEMITSU_2512-2.csv new file mode 100644 index 0000000..fd9496d --- /dev/null +++ b/Sample-data/IDEMITSU_2512-2.csv @@ -0,0 +1,9 @@ +J[h,@ +x,2025/12/08 +񂲐z,0000004690 + +p,pXyяi,{lEƑ敪,x敪,O敪,pz,l +2025/09/26,dsb{@@iO}ވ]j,,P,,970, +2025/09/26,dsb{@@iވ]쁨O}j,,P,,970, +2025/10/08,dsb{@@i鐲r`Xj,,P,,1780, +2025/10/30,dsb{@@iO}ވ]j,,P,,970, diff --git a/Sample-data/IDEMITSU_2601.csv b/Sample-data/IDEMITSU_2601.csv new file mode 100644 index 0000000..c9e5953 --- /dev/null +++ b/Sample-data/IDEMITSU_2601.csv @@ -0,0 +1,25 @@ +J[h,oS[hJ[h +x,2026/01/07 +񂲐z,0000132408 + +p,pXyяi,{lEƑ敪,x敪,O敪,pz,l +2025/11/26,L@@@@@@@@@@,,P,,23926,ʁFPXR +2025/11/10,`ookd@bnl@ahkk,,P,,150, +2025/11/12,`ookd@bnl@ahkk,,P,,480, +2025/11/13,vm@^LJe,,P,,18128, +2025/11/15,Kl嗤PCwOX,,P,,57000, +2025/11/24,`adl`v~A,,P,,1080, +2025/11/26,nodm`h@bg`sfos@rtarbq,,P,,3568,nʉ݊zFQQDOO@trc +,ir`m@eq`mbhrbnj,,,,,~Z[gFPP^QV@PUQDPWPX +2025/11/26,cn,,P,,2774, +2025/11/28,`vC,,P,,2950, +2025/11/28,`ookd@bnl@ahkk,,P,,1350, +2025/11/28,zNVbveeVȂX,,P,,3065, +2025/11/30,`l`ynmDbnDio,,P,,1577, +2025/11/30,`l`ynmDbnDio,,P,,4971, +2025/12/01,GbNXT|o|^l,,P,,2200, +2025/12/01,OD@hCT[rX,,P,,272, +2025/12/01,`ookd@bnl@ahkk,,P,,1200, +2025/12/03,`ookd@bnl@ahkk,,P,,480, +2025/12/08,OD^T|o|,,P,,2612, +2025/12/10,AbgEjteB,,P,,4625, diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..fdd567d --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +-r requirements.txt +pytest>=7.4,<8.0 +pytest-django>=4.5,<5.0 +ruff>=0.3,<0.4 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e0c2805 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +Django>=4.2,<5.0 +psycopg[binary]>=3.1,<4.0 +chardet>=5.2,<6.0 +WeasyPrint>=60.0,<61.0