{"id":31943724,"url":"https://github.com/eva-kaushik/dse-511-refactoring-and-documenting-code","last_synced_at":"2026-07-23T00:32:33.734Z","repository":{"id":317777902,"uuid":"1068802055","full_name":"Eva-Kaushik/DSE-511-Refactoring-and-Documenting-Code","owner":"Eva-Kaushik","description":"Refactored code for modularity with clear functions and docstrings for readability and maintainability.","archived":false,"fork":false,"pushed_at":"2025-10-02T23:54:25.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T09:38:09.904Z","etag":null,"topics":["programming","python","refactoring-exercise","software-engineering"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eva-Kaushik.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-02T23:47:06.000Z","updated_at":"2025-10-03T00:00:43.000Z","dependencies_parsed_at":"2025-10-03T01:27:16.888Z","dependency_job_id":"6d7e64d9-29df-4385-bbd6-c25fbe061acf","html_url":"https://github.com/Eva-Kaushik/DSE-511-Refactoring-and-Documenting-Code","commit_stats":null,"previous_names":["eva-kaushik/dse-511-refactoring-and-documenting-code"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Eva-Kaushik/DSE-511-Refactoring-and-Documenting-Code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eva-Kaushik%2FDSE-511-Refactoring-and-Documenting-Code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eva-Kaushik%2FDSE-511-Refactoring-and-Documenting-Code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eva-Kaushik%2FDSE-511-Refactoring-and-Documenting-Code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eva-Kaushik%2FDSE-511-Refactoring-and-Documenting-Code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eva-Kaushik","download_url":"https://codeload.github.com/Eva-Kaushik/DSE-511-Refactoring-and-Documenting-Code/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eva-Kaushik%2FDSE-511-Refactoring-and-Documenting-Code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35783461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"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":["programming","python","refactoring-exercise","software-engineering"],"created_at":"2025-10-14T10:00:19.762Z","updated_at":"2026-07-23T00:32:33.716Z","avatar_url":"https://github.com/Eva-Kaushik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Homework 5: Refactoring and Documenting Code\n\nI took a messy Python script (`bad_python.py`) and refactors it into a more modular, maintainable, and testable version. The refactored script read data.csv, computes summary statistics (mean and standard deviation), samples random rows, and visualizes the data in a histogram.\n\n### What all changes I did in bad_python.csv\n\n##### The original script entails:\n\n1. Loaded the CSV directly without error handling.\n2. Computed averages and standard deviations manually with loops.\n3. Repeated logic (random sampling).\n4. Had no functions, no comments, and no testing.\n\n##### The refactored script now entails:\n\n1. Uses modular functions with descriptive names (compute_average, compute_std_dev, sample_rows, plot_histogram, run_analysis).\n2. Includes docstrings and inline comments for every function.\n3. Adds error handling for empty inputs, wrong column names, and non-numeric data.\n4. Uses NumPy for efficient math instead of manual loops.\n5. Introduces logging for runtime clarity instead of raw print statements.\n6. Adds unit tests with unittest to validate correctness and edge cases.\n\n### How come the changes enhanced my code? \nAll the changes make the code cleaner and easier to follow (readability), more reliable with clear error handling and tests, and reusable. Logging and modular design improved professionalism and maintainability, making it closer to standards.\n\n### In what way I created data.csv? \nI generated a random dataset(id,value,category,date) with line 15 (value = 35.0) acting as a mild outlier to test standard deviation with sequential dates (lines 1–15) to keep the dataset analysis easy going.\n\n### What exactly value dist. vs count histogram showcases? \nThe histogram displays values from ~18 to 28, with counts reflecting repeated entries. We did automatic axis scaling, which focuses on the main data distribution.\n\n### This submission covers all required steps of assignment completion:\n\n1. Step 1: Chose the messy provided script (bad_python.csv)\n2. Step 2: Refactored into modular functions with comments/docstrings.\n3. Step 3: Added unit tests for both normal and error cases.\n4. Step 4: Added README.md file for documentation and reproducibility.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feva-kaushik%2Fdse-511-refactoring-and-documenting-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feva-kaushik%2Fdse-511-refactoring-and-documenting-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feva-kaushik%2Fdse-511-refactoring-and-documenting-code/lists"}