-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_structure.py
More file actions
58 lines (50 loc) · 1.8 KB
/
Copy pathinit_structure.py
File metadata and controls
58 lines (50 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
from pathlib import Path
def build_specific_structure():
root = Path("D:/ML/Customer Segmentation")
# Define the folders
folders = [
"app/api_v1",
"data/raw",
"data/processed",
"data/engine",
"database",
"ml",
"models",
"notebooks",
"scripts",
"tests/unit",
"tests/integration"
]
# Define files with starter code
files = {
"app/__init__.py": "",
"app/main.py": "# FastAPI Entry\nfrom fastapi import FastAPI\napp = FastAPI()",
"app/schemas.py": "# Pydantic models",
"app/model_handler.py": "# Load joblib files",
"app/api_v1/endpoints.py": "# API routes",
"database/db_session.py": "# SQL Connection",
"database/models.py": "# ORM Models",
"database/queries.sql": "-- SQL for RFM aggregation",
"ml/train.py": "# Clustering Logic",
"ml/transformations.py": "# Scaling/RFM Pipelines",
"scripts/ingest_data.py": "# CSV to SQL",
"requirements.txt": "fastapi\nuvicorn\npandas\nscikit-learn\nsqlalchemy\npsycopg2-binary",
".gitignore": ".venv/\n__pycache__/\n*.csv\n*.joblib\n*.bin\n.env",
"README.md": f"# Customer Segmentation\nLocation: {root}"
}
print(f"--- Initializing Project at: {root} ---")
# Create directories
for folder in folders:
path = root / folder
path.mkdir(parents=True, exist_ok=True)
print(f"Created: {path}")
# Create files
for file_path, content in files.items():
f = root / file_path
if not f.exists():
f.write_text(content)
print(f"Created File: {file_path}")
print("\n✅ All folders and placeholder files created successfully!")
if __name__ == "__main__":
build_specific_structure()