Skip to content

johnpapwinter/person-health-data-pipeline

Repository files navigation

Person Health Data Pipeline API

A FastAPI-based service that processes CSV files containing person health data. The API validates, transforms, and provides processed health data through a streaming response.

Overview

This API provides a robust pipeline for processing health-related CSV data. It follows a modular architecture with error handling, logging, and configurable environments. The service is containerized and uses Poetry for dependency management.

Features

  • CSV file processing with built-in validation
  • Streaming response for efficient data handling
  • Containerized deployment

Getting Started

Prerequisites

  • Python 3.12 or higher
  • Poetry
  • Docker (optional)

Local Development Setup

  1. Clone the repository:
git clone https://github.com/johnpapwinter/person-health-data-pipeline.git
cd person-health-pipeline
  1. Install dependencies using Poetry:
poetry install
  1. Run the application:
poetry run uvicorn main:app --reload

The API will be available at http://localhost:8000

Docker Setup

  1. Build the Docker image:
docker build -t person-health-pipeline .
  1. Run the container:
docker run -p 8000:8000 person-health-pipeline

API Documentation

After starting the server, visit:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Endpoints

Process CSV File

POST /api/v1/pipeline/process

Processes a CSV file containing person health data.

Request

  • Content-Type: multipart/form-data
  • Body: CSV file with required columns:
    • GivenName
    • Gender
    • Age
    • Kilograms
    • Centimeters

Response

  • Success: 200 OK
    • Content-Type: text/csv
    • Body: Processed CSV file
  • Error: 400 Bad Request
    • Invalid file format or data
  • Error: 500 Internal Server Error
    • Processing errors

CSV File Format

The input CSV file must contain the following columns:

GivenName,Gender,City,Age,Kilograms,Centimeters
Jennifer,female,Somerville,20,80.5,172

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published