Serendipity2-0 / TradeManV1

0 stars 0 forks source link

Debt Model Database #97

Open amolkittur opened 5 days ago

amolkittur commented 5 days ago

Convert Excel File to Database, Implement Data Flow, and Integrate FastAPI Endpoints

Description

We need to convert our current Excel file to a database, implement a specific data flow in our PyQt application, and integrate FastAPI endpoints for communication between the PyQt app and the database.

Required Data Flow

  1. Update Transactions

    • Check if the user is already present in the freedom blast/accounts if not then we have to do the manual entry else it will processed automatically
    • User inputs values through the PyQt interface
    • The values should be updated in the excel as well as the database using the endpoint.
    • These values should be appended to the "Transactions(Past)" sheet/table
  2. Account Verification and Creation

    • Check if the AccID exists in the "Accounts(Present)" sheet/table
    • If not present, create a new account
    • If present, show the entry in the "5_Hand Loans" sheet/table
  3. Balance Update in "5_Hand Loans"

    • Check if there's an entry with the same AccID in "5_Hand Loans"
    • If not present, enter the data without modifications
    • If present: a. Fetch the previous entry b. Get the value from the Balance column c. Add the new Amount to the previous Balance d. Write the updated Balance in a new row
    1. Update the same in the DB
      • Instead of converting the entire excel file we can convert only the necessary sheets to DB and keep on appending the values there

Tasks

  1. [ ] Convert the Excel file to a database format
  2. [ ] Modify the PyQt application to interact with the new database
  3. [ ] Implement the data flow logic as described above
  4. [ ] Implement FastAPI endpoints for database operations
  5. [ ] Integrate FastAPI endpoints into the PyQt application
  6. [ ] Test the new system thoroughly to ensure data integrity and correct flow
  7. [ ] Document the new database structure, data flow, and API endpoints for future reference

FastAPI Integration

Additional Notes

amolkittur commented 3 days ago

API Endpoint Development for Transaction Management

Overview

We need to develop several API endpoints to handle transactions imported from an Excel file and perform various operations such as fetching, modifying, deleting, and verifying transactions. Below is a detailed description of each endpoint, including methods, URLs, parameters, and functionalities.


Table of Contents

  1. Import Transactions from Excel
  2. Modify a Transaction
  3. Delete a Transaction
  4. Fetch Weekly Transactions
  5. Additional Considerations
  6. Summary of Endpoints

1. Import Transactions from Excel

Endpoint: transactions/import-transactions
Method: POST

Description:

Parameters:


2. Modify a Transaction

Endpoint: /transactions/{trNo}/{transactionId} **Method:**PUT`

Description:

Parameters:

Request Body:

{
  "columnName1": "newValue1",
  "columnName2": "newValue2"
  // Add additional columns and values as needed
}

Need to decide on how to pass which fields to modify or how to send only which values needs to be changed


3. Delete a Transaction

Endpoint: /transactions/{trNo}/{transactionId}
Method: DELETE

Description:

Parameters:


4. Fetch Weekly Transactions

Endpoint: /transactions/{trNo}/weekly
Method: GET

Description:

Parameters:


5. Summary of Endpoints

  1. Import Transactions

    POST /transactions/import?month=September
  2. Modify Transaction

    PUT /transactions/{trNo}/{transactionId}
    Body: { "columnName1": "newValue1", "columnName2": "newValue2" }
  3. Delete Transaction

    DELETE /transactions/{trNo}/{transactionId}
  4. Fetch Weekly Transactions

    GET /transactions/{trNo}/weekly?weekStart=YYYY-MM-DD&weekEnd=YYYY-MM-DD

Action Items


Note: Adjust the endpoints and parameters as necessary to fit the specific requirements of your application. Feel free to suggest improvements or additional features that could enhance the system.


Additional Notes


Let me know if there's anything else you'd like to add or modify!