Python server for processing crowdsourced credit card benefits and offers data from Microsoft Forms.
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.txt
cp .env.example .env
# Edit .env with your configuration
uvicorn main:app --reload --host 0.0.0.0 --port 8000
The 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
Forms.Read.All.envExport responses to Excel
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.git
cd /path/to/OGWallet
git submodule add https://github.com/yourusername/ogwallet-data.git composeApp/src/commonMain/resources/data
git submodule update --init --recursive
cd 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.py
pytest
black .
mypy .
MIT