{"id":28561096,"url":"https://github.com/codelion/random-objects-challenge","last_synced_at":"2025-11-10T02:05:08.667Z","repository":{"id":286624709,"uuid":"962004586","full_name":"codelion/random-objects-challenge","owner":"codelion","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-07T13:59:28.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T14:42:00.313Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/codelion.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}},"created_at":"2025-04-07T13:58:32.000Z","updated_at":"2025-04-07T13:59:32.000Z","dependencies_parsed_at":"2025-04-07T14:52:06.786Z","dependency_job_id":null,"html_url":"https://github.com/codelion/random-objects-challenge","commit_stats":null,"previous_names":["codelion/random-objects-challenge"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Frandom-objects-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Frandom-objects-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Frandom-objects-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Frandom-objects-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelion","download_url":"https://codeload.github.com/codelion/random-objects-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelion%2Frandom-objects-challenge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259054151,"owners_count":22798450,"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-06-10T10:14:05.679Z","updated_at":"2025-11-10T02:05:08.624Z","avatar_url":"https://github.com/codelion.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Random Objects Generator and Processor\n\nThis project implements a solution for the software engineering challenge with three parts:\n\n1. **Challenge A**: Generate 10MB of random objects of four different types, separated by commas\n2. **Challenge B**: Process the generated file to identify and print each object's type\n3. **Challenge C**: Dockerize Challenge B to read the file and save results to the host machine\n\n## Project Overview\n\n### Challenge A: Random Objects Generator\n\nThe generator creates a file containing four types of random objects:\n\n1. **Alphabetical strings**: Random strings containing only letters (a-z, A-Z)\n2. **Real numbers**: Random floating-point numbers (e.g., -8765.432109)\n3. **Integers**: Random whole numbers (e.g., 42, -789)\n4. **Alphanumerics with spaces**: Random strings with letters and numbers, with 0-10 spaces before and after\n\nThese objects are separated by commas, and the output file is 10MB in size by default.\n\n### Challenge B: Objects Processor\n\nThe processor:\n- Reads the file generated in Challenge A\n- Identifies the type of each object using regex patterns\n- Prints each object and its type to the console\n- Strips spaces before and after alphanumeric objects as required\n- Provides a summary of object type counts and percentages\n\n### Challenge C: Dockerized Processor\n\nA Docker container that:\n- Takes the generated file as input through a volume mount\n- Runs the processor from Challenge B\n- Saves the output to a file accessible from the host machine\n- Configurable through environment variables\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.6 or higher\n- Docker and Docker Compose (for Challenge C)\n\n### Project Structure\n\n```\nrandom-objects-challenge/\n├── README.md                # This documentation\n├── src/\n│   ├── generator.py         # Challenge A: Random objects generator\n│   └── processor.py         # Challenge B: Object type processor\n├── Dockerfile               # Challenge C: Docker configuration\n└── docker-compose.yml       # For easier Docker execution\n```\n\n### Running Challenge A: Generate Random Objects\n\n```bash\n# Create a 10MB file of random objects\npython src/generator.py\n\n# Optionally specify filename and size (in MB)\npython src/generator.py random_objects.txt 10\n```\n\nThe generator will create a file with the specified name (default: `random_objects.txt`) containing random objects separated by commas. Progress information will be displayed during generation.\n\n### Running Challenge B: Process the Generated File\n\n```bash\n# Process the file and print results to console\npython src/processor.py random_objects.txt\n\n# Save results to a file\npython src/processor.py random_objects.txt results.txt\n```\n\nThe processor will:\n1. Read the input file\n2. Identify the type of each object\n3. Print the object and its type\n4. Display a summary of object types\n5. Save the results to the specified output file (if provided)\n\n### Running Challenge C: Dockerized Processing\n\n1. Create necessary directories:\n\n```bash\nmkdir -p data output\n```\n\n2. Place the generated file in the data directory:\n\n```bash\ncp random_objects.txt data/\n```\n\n3. Run the Docker container:\n\n```bash\n# Using Docker Compose (recommended)\ndocker-compose up\n\n# Or directly with Docker\ndocker build -t random-objects-processor .\ndocker run -v $(pwd)/data:/app/input -v $(pwd)/output:/app/output random-objects-processor\n```\n\n4. Check the results:\n\n```bash\ncat output/results.txt\n```\n\n## Implementation Details\n\n### Generator (Challenge A)\n\nThe generator uses:\n- Random string generation with configurable length\n- Buffered file writing for efficiency\n- Progress tracking during generation\n- Consistent distribution of the four object types\n\n### Processor (Challenge B)\n\nThe processor uses regex patterns to identify object types:\n- `^-?\\d+$` identifies Integers\n- `^-?\\d+\\.\\d+$` identifies Real Numbers\n- `^[a-zA-Z]+$` identifies Alphabetical Strings\n- `^\\s*[a-zA-Z0-9]+\\s*$` identifies Alphanumerics (with spaces that get stripped)\n\n### Docker Container (Challenge C)\n\nThe Docker implementation:\n- Uses a lightweight Python image\n- Maps volumes for input and output\n- Provides configurable environment variables\n- Processes the input file and saves results to the output volume\n\n## Performance Considerations\n\n- The generator uses buffered writing to improve performance when creating large files\n- The processor loads the entire file into memory, which is appropriate for the 10MB file size\n- For extremely large files, a streaming approach could be implemented\n- Progress tracking is provided for both generation and processing\n\n## Extension Ideas\n\nIf you want to extend this project, consider:\n1. Adding more object types\n2. Implementing streaming processing for very large files\n3. Adding a web interface to visualize the results\n4. Enhancing statistics and analysis of the generated data\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelion%2Frandom-objects-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelion%2Frandom-objects-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelion%2Frandom-objects-challenge/lists"}