To run ETL and host the endpoint via FastAPI in docker container.
- Transform parquet format object to structured data to ingest into Postgres database.
- Serve the endpoint for POST method, having voucher amount response for the customer's request.
- Store the request to main table to update segments' values.
{"vocher_amount": 10}
- Install docker
docker-compose up -d
Open another prompt and connect postgres via psql to check the result
docker exec -it postgres_db psql -h postgres_db -U user -d voucher_selection
pip install pytest
pytest
curl http://0.0.0.0:8080/voucher -X POST \
-H "Content-type: application/json" \
-d '{"customer_id": 555, "country_code": "Peru", "last_order_ts": "2022-05-03 00:00:00", \
"first_order_ts": "2017-05-03 00:00:00", "total_orders": 35, "segment_name": "frequency_segment"}'