backend / app /service /income_statement.py
praneethys's picture
apis for generate p&l (#9)
a4ef0c7 verified
raw
history blame
665 Bytes
from app.schema.index import IncomeStatementCreate
from app.model.transaction import Transaction as TransactionModel
from app.model.income_statement import IncomeStatement as IncomeStatementModel
from sqlalchemy.ext.asyncio import AsyncSession
async def call_llm_to_create_income_statement(payload: IncomeStatementCreate, db: AsyncSession) -> None:
transactions = await TransactionModel.get_by_user_between_dates(
db, payload.user_id, payload.date_from, payload.date_to
)
# TODO: Call LLM to generate income and expenses
income = {}
expenses = {}
await IncomeStatementModel.create(db, **payload, income=income, expenses=expenses)