{"id":25444193,"url":"https://github.com/dioptx/rated-coding-challenge","last_synced_at":"2025-08-13T01:35:47.040Z","repository":{"id":200793165,"uuid":"706250167","full_name":"dioptx/rated-coding-challenge","owner":"dioptx","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-17T17:45:22.000Z","size":580,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-15T08:01:07.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/dioptx.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}},"created_at":"2023-10-17T15:23:22.000Z","updated_at":"2023-10-17T15:24:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c05b4e0-8b1f-4aa2-8788-25695630fc42","html_url":"https://github.com/dioptx/rated-coding-challenge","commit_stats":null,"previous_names":["dioptx/rated-coding-challenge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dioptx/rated-coding-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioptx%2Frated-coding-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioptx%2Frated-coding-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioptx%2Frated-coding-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioptx%2Frated-coding-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dioptx","download_url":"https://codeload.github.com/dioptx/rated-coding-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dioptx%2Frated-coding-challenge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265887026,"owners_count":23844326,"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","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":[],"created_at":"2025-02-17T15:29:56.111Z","updated_at":"2025-07-19T04:03:13.173Z","avatar_url":"https://github.com/dioptx.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ethereum Transactions Analysis Project\n\n## Overview\nThis project aims to manipulate and analyze an Ethereum transaction dataset using Python and FastAPI. The solution focuses on calculating the execution timestamp of each transaction, computing the gas cost, fetching the approximate price of ETH at the transaction execution time, and computing the dollar cost of gas used. Additionally, the processed transactions are populated into a PostgreSQL database.\n\n## Project Structure\n- `fastapi-app/`: Contains the FastAPI code for serving transaction data and stats.\n- `docker-compose.yml`: Docker Compose file for orchestrating the Postgres and FastAPI server containers.\n- `notebooks/ethereum_txs.csv`: The Ethereum transaction dataset.\n- `notebooks/ethereum_txs_lite.csv`: The Ethereum a sample of the transaction dataset.\n- `notebooks/`: Contains Jupyter Notebook(s) for data processing and analysis.\n\n## Setup and Execution\n\n### Prerequisites\n- Docker and Docker Compose installed on your machine.\n\n### Steps\n1. Clone the repository to your local machine.\n2. Navigate to the project directory.\n3. Build and start the Docker containers using Docker Compose:\n   ```bash\n   docker-compose up --build -d\n\n## Key Questions\n1. What is the method to compute the approximate execution timestamp for each transaction?\n2. How do we calculate the gas cost for each transaction, expressed in Gwei?\n3. How can we fetch the real-time approximate price of ETH at the time of transaction execution?\n4. What are the steps to populate the processed transactions into a local PostgreSQL database?\n5. How is the FASTAPI implemented to serve both individual transaction data and global statistics?\n\n## Setup and Execution\n\n### Prerequisites\n- Docker must be installed.\n\n### Steps\n1. **Clone the Repository**: Clone the project repository to your local system.\n2. **Navigate to Project Directory**: Move to the project's root directory in your terminal.\n3. **Run Docker Compose**: Execute the following command to build and start the Docker containers.\n    ```bash\n    docker-compose up --build -d\n    ```\n4. **Access Jupyter Notebook**: Open `http://localhost:8888` in a web browser. Use the password `password` to log in and run the data processing notebooks.\n5. **Populate the db**: Run either data_ingestion.ipynb for a batch import of the csv data, or the streaming_data_ingestion.ipynb for a streaming version through Kafka\n6. **FASTAPI**: The API will be live at `http://localhost:5001`. Use the following endpoints:\n    - Fetch a transaction: `GET /transactions/:hash`\n    - Retrieve global stats: `GET /stats`\n7. **Shutdown**: To halt and remove the Docker containers, use:\n    ```bash\n    docker-compose down\n    ```\n\n## API Endpoints\n- **Fetch Transaction**\n  - **URL**: `/transactions/:hash`\n  - **Method**: `GET`\n  - **URL Params**: `hash=[string]`\n  - **Success**: `200 OK`\n  - **Failure**: `404 Not Found`\n\n- **Global Stats**\n  - **URL**: `/stats`\n  - **Method**: `GET`\n  - **Success**: `200 OK`\n\n## Database Schema\nThe PostgreSQL database, named `transactions_db`, includes a `transactions` table containing the processed transaction data.\n\n## Notebooks\nJupyter Notebooks in the `notebooks/` directory contain all the code required for data processing and database population.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdioptx%2Frated-coding-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdioptx%2Frated-coding-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdioptx%2Frated-coding-challenge/lists"}