Python server for processing crowdsourced credit card benefits and offers data from Microsoft Forms.
- π Microsoft Forms Integration - Fetch responses from Microsoft Forms or process Excel exports
- π Automated Processing - Convert form responses to structured JSON data
- π¦ Git Submodule Management - Automatically commit and push data updates
- π REST API - Expose data via FastAPI endpoints
- β Data Validation - Pydantic models ensure data quality
Microsoft Forms β Python Server β Git Repository β Kotlin App
β
Validation
Processing
Deduplication
cd data-server
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtcp .env.example .env
# Edit .env with your configurationuvicorn main:app --reload --host 0.0.0.0 --port 8000The server will be available at http://localhost:8000
GET /
GET /stats
POST /process-forms
Fetches new responses from Microsoft Forms and updates the data repository.
GET /offers?category=dining&active_only=true
GET /benefits?card_name=Chase%20Sapphire
- Register an app in Azure AD
- Grant permissions:
Forms.Read.All - Get API key and Form ID
- Configure in
.env
-
Create a Microsoft Form with these fields:
- Card Name (Text)
- Bank Name (Text)
- Offer Title (Text)
- Offer Description (Long text)
- Category (Choice: Dining, Travel, Shopping, Gas, Groceries, Entertainment, Other)
- Expiry Date (Date)
- Minimum Spend (Number)
- Benefit Value (Text)
- Email (Email)
-
Export responses to Excel
-
Process the Excel file:
from forms_processor import FormsProcessor
processor = FormsProcessor("", "")
responses = processor.process_excel_export("path/to/responses.xlsx")# Create a new repository for data
mkdir ogwallet-data
cd ogwallet-data
git init
git remote add origin https://github.com/yourusername/ogwallet-data.gitcd /path/to/OGWallet
git submodule add https://github.com/yourusername/ogwallet-data.git composeApp/src/commonMain/resources/data
git submodule update --init --recursivecd composeApp/src/commonMain/resources/data
git pull origin main
cd ../../../..
git add composeApp/src/commonMain/resources/data
git commit -m "Update credit card data"See models.py for complete schema definitions.
{
"id": "unique-id",
"title": "5x Points on Dining",
"description": "Earn 5 points per dollar at restaurants",
"card_name": "Chase Sapphire Preferred",
"bank_name": "Chase",
"category": "dining",
"expiry_date": "2024-12-31",
"emoji": "π½οΈ",
"gradient_colors": ["#f97316", "#ef4444"],
"is_active": true
}You can set up GitHub Actions to automatically process forms on a schedule:
# .github/workflows/process-forms.yml
name: Process Forms Data
on:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch:
jobs:
process:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: pip install -r data-server/requirements.txt
- run: python data-server/process_forms.pypytestblack .mypy .MIT