{"id":31650441,"url":"https://github.com/alibpowell/survey-intake-api","last_synced_at":"2026-04-20T19:31:56.410Z","repository":{"id":317304841,"uuid":"1066828472","full_name":"alibpowell/Survey-Intake-API","owner":"alibpowell","description":"A lightweight backend API I built to collect, validate, deduplicate, and store survey responses in NDJSON format as a backend development experiment.","archived":false,"fork":false,"pushed_at":"2025-10-06T16:12:28.000Z","size":19452,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T18:23:15.101Z","etag":null,"topics":["api","flask","idempotency","logging","ndjson","pydantic","python","rest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibpowell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-30T02:40:09.000Z","updated_at":"2025-10-06T16:12:31.000Z","dependencies_parsed_at":"2025-10-06T18:24:27.727Z","dependency_job_id":null,"html_url":"https://github.com/alibpowell/Survey-Intake-API","commit_stats":null,"previous_names":["alibpowell/case4sept29","alibpowell/survey-intake-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/alibpowell/Survey-Intake-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibpowell%2FSurvey-Intake-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibpowell%2FSurvey-Intake-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibpowell%2FSurvey-Intake-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibpowell%2FSurvey-Intake-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibpowell","download_url":"https://codeload.github.com/alibpowell/Survey-Intake-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibpowell%2FSurvey-Intake-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019053,"owners_count":26086512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","flask","idempotency","logging","ndjson","pydantic","python","rest"],"created_at":"2025-10-07T08:29:34.072Z","updated_at":"2025-10-14T11:08:15.599Z","avatar_url":"https://github.com/alibpowell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Survey Intake API\n\nA lightweight backend service I built and further developed for collecting and storing post-interaction survey responses. The API validates incoming data, handles deduplication, and saves submissions in an append-only NDJSON format. This project was a experiment in backend development, API design, and data validation, done in collaboration with a class by Dr. Daniel G. Graham, PhD in the UVA School of Data Science.\n\n---\n\n## Features\n\n- **RESTful Endpoint**: `POST /v1/survey` accepts survey responses in JSON format.\n- **Data Validation**: Uses Pydantic to enforce field types and constraints:\n  - `name` (string, 1–100 chars)\n  - `email` (valid email)\n  - `age` (integer, 13–120)\n  - `consent` (boolean, default `true`)\n  - `rating` (integer, 1–5)\n  - Optional: `comments` (string, ≤1000 chars), `source` (`web`, `mobile`, `other`; default `other`)\n- **Server-Enriched Fields**: Automatically logs `received_at` (UTC timestamp), `ip`, and `user_agent` (if available) for each submission.\n- **Idempotency \u0026 Deduplication**: Supports submission IDs or generates a SHA256 hash from email + timestamp to avoid duplicate entries.\n- **Append-Only Storage**: Stores each submission as a single line in NDJSON (`data/survey.ndjson`) for easy processing and analytics.\n- **Observability \u0026 Privacy**:\n  - Logs request metadata (status, latency, request_id) without exposing PII.\n  - Supports metrics like submission counts, average rating, consent rate, and weekly volume.\n\n---\n\n## Tech Stack\n\n- Python 3.11+\n- Flask\n- Pydantic\n- Flask-CORS\n- NDJSON storage\n\n---\n\n## Getting Started\n\n### Installation\n\n```bash\ngit clone https://github.com/yourusername/survey-intake-api.git\ncd survey-intake-api\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n```\n\n### To Run the Server\n\n```bash \nexport FLASK_APP=app.py\nflask run --port #add desired port here\n```\n## API Usage\n\n### Example Request\n\n```bash\ncurl -X POST http://localhost:1234/v1/survey \\\n-H \"Content-Type: application/json\" \\\n-d '{\n  \"name\": \"Alice Powell\",\n  \"email\": \"alice@example.com\",\n  \"age\": 25,\n  \"consent\": true,\n  \"rating\": 5,\n  \"comments\": \"Great experience!\",\n  \"source\": \"web\"\n}'\n```\n\n## Example Responses\n\n- Success (201 Created)\n- Bad Request (400) - Invalid JSON\n- Unprocessable Entity (422) - Field validation error\n\n### Project Structure\n\n```bash\ncase4sept29/\n├── app.py           # Flask application \u0026 routing\n├── models.py        # Pydantic models for validation\n├── storage.py       # NDJSON storage \u0026 deduplication logic\n├── data/\n│   └── survey.ndjson\n├── frontend/        # Placeholder for frontend assets\n├── tests/           # Minimal Flask test examples\n├── .venv/           # Virtual environment\n├── requirements.txt # Project dependencies (more seperatley installed in other files)\n└── README.md        # Project documentation\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibpowell%2Fsurvey-intake-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibpowell%2Fsurvey-intake-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibpowell%2Fsurvey-intake-api/lists"}