{"id":25155007,"url":"https://github.com/rohit1kumar/python-algorithm-assignment","last_synced_at":"2025-04-03T10:44:56.337Z","repository":{"id":276120738,"uuid":"928278656","full_name":"rohit1kumar/python-algorithm-assignment","owner":"rohit1kumar","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-06T12:25:40.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T12:31:15.440Z","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/rohit1kumar.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-02-06T11:20:30.000Z","updated_at":"2025-02-06T12:25:44.000Z","dependencies_parsed_at":"2025-02-06T12:41:20.672Z","dependency_job_id":null,"html_url":"https://github.com/rohit1kumar/python-algorithm-assignment","commit_stats":null,"previous_names":["rohit1kumar/python-algorithm-assignment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fpython-algorithm-assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fpython-algorithm-assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fpython-algorithm-assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit1kumar%2Fpython-algorithm-assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohit1kumar","download_url":"https://codeload.github.com/rohit1kumar/python-algorithm-assignment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989501,"owners_count":20865306,"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-09T00:19:50.341Z","updated_at":"2025-04-03T10:44:56.310Z","avatar_url":"https://github.com/rohit1kumar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Algorithm Assignment\n\n## Tech Stack\n\n- FastAPI\n- Redis\n- Docker\n\n## Setup and Run\n\n1. Clone the repository \u0026 move to the dir:\n   ```bash\n   git clone https://github.com/rohit1kumar/python-algorithm-assignment.git\n   cd python-algorithm-assignment\n   ```\n2. Use docker to run the application\n   ```bash\n   docker-compose up --build\n   ```\n3. Access the application at http://localhost:8000\n\n4. API Docs are available at http://localhost:8000/docs\n\n## Unit Tests\n\nTo run the unit tests, use the following command:\n\n```bash\npytest -v # make sure you have pytest installed\n```\n\n## TODO's completed\n\n- [x] Implement the API using FastAPI\n- [x] Implement the Unit Tests using pytest\n- [x] Implement the Docker Compose\n- [x] Implement the Cache using Redis\n\n## API endpoints\n\n`POST /tsp/solve`\n\nbody:\n\n```json\n{\n\t\"cities\": [\"A\", \"B\", \"C\", \"D\"],\n\t\"distances\": {\n\t\t\"A\": {\n\t\t\t\"B\": 10,\n\t\t\t\"C\": 15,\n\t\t\t\"D\": 20\n\t\t},\n\t\t\"B\": {\n\t\t\t\"A\": 10,\n\t\t\t\"C\": 35,\n\t\t\t\"D\": 25\n\t\t},\n\t\t\"C\": {\n\t\t\t\"A\": 15,\n\t\t\t\"B\": 35,\n\t\t\t\"D\": 30\n\t\t},\n\t\t\"D\": {\n\t\t\t\"A\": 20,\n\t\t\t\"B\": 25,\n\t\t\t\"C\": 30\n\t\t}\n\t}\n}\n```\n\n`POST /knapsack/solve`\n\nbody:\n\n```json\n{\n\t\"max_weight\": 60,\n\t\"items\": [\n\t\t{\n\t\t\t\"name\": \"Laptop\",\n\t\t\t\"weight\": 10,\n\t\t\t\"value\": 60\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Phone\",\n\t\t\t\"weight\": 20,\n\t\t\t\"value\": 100\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Tablet\",\n\t\t\t\"weight\": 30,\n\t\t\t\"value\": 120\n\t\t}\n\t]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit1kumar%2Fpython-algorithm-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit1kumar%2Fpython-algorithm-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit1kumar%2Fpython-algorithm-assignment/lists"}