How santhought/etl_exam_datasetb works
This project is an ETL (Extract, Transform, Load) pipeline that integrates three main services using Docker Compose: a Neo4j database (with a custom Docker image), a PostgreSQL database, and an API built with Node.js. The ETL process leverages Docker’s containerization and orchestration to manage data flow from loading CSV data into Neo4j, extracting and transforming that data via an API, then loading it into PostgreSQL and finally exporting a recap CSV file.
Main Components
• Neo4j Database Service:
• Represented by a container using a custom Dockerfile (in neo4j_custom).
• Responsible for the initial CSV data load using a Cypher query.
• Customizations implemented (e.g. installation of curl to support healthchecks).
• PostgreSQL Database Service:
• Represented by a container initialized with a SQL script (in postgres/init.sql).
• Acts as the destination for the transformed data.
• API Service (ETL Engine):
• Built with Node.js (files in the api folder).
• Contains endpoints for health checks, extract (GET), load (POST), and export (GET) operations.
• Responsible for coordinating the ETL process.
• Docker Compose (Orchestration):
• Coordinates the startup order and internal networking between containers.
• Uses a .env file to inject environment variables (credentials, etc.) into each container.
• Data/Output:
• The raw input CSV file under the neo4j folder.
• The generated output recap CSV under the output folder.
Relationships and Data Flow
• The CSV file in the neo4j folder is loaded into the Neo4j database as the initial data ingestion step.
• The API first extracts data from Neo4j (triggered by a GET request to “/api/extract”).
• The API then transforms the data and loads it into PostgreSQL (triggered by a POST request to “/api/load”).
• Finally, the API exports results as a CSV file (GET request to “/api/export”), saved to the output folder.
• Each service is interconnected via Docker Compose, ensuring a proper sequence and communication between components.
Architectural Patterns & Design Principles
• Containerization: Each main service is isolated in its own container, ensuring consistency and ease of deployment.
• Microservice-style Separation: Although a small project, separation of concerns is clear (dedicated containers for Neo4j, PostgreSQL, and API).
• Environment Configuration: Use of a shared environment file (.env) to centralize sensitive configuration.
• Use service health checks: Consider noting how each container resolves its dependencies (e.g., customizing images to include needed utilities like curl).
Relevant Technologies
• Docker & Docker Compose for container orchestration.
• Neo4j (graph database) with a customized image for extra tooling.
• PostgreSQL (relational database) for the final data store.
• Node.js (and likely Express) in the API service for handling HTTP requests and ETL logic.