{"id":38252508,"url":"https://github.com/umerf52/railway_system_assessment","last_synced_at":"2026-01-17T01:28:38.012Z","repository":{"id":199776943,"uuid":"703680018","full_name":"umerf52/railway_system_assessment","owner":"umerf52","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-28T10:21:17.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-28T11:36:36.645Z","etag":null,"topics":["fastapi"],"latest_commit_sha":null,"homepage":"https://railway-system-assessment.vercel.app","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/umerf52.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}},"created_at":"2023-10-11T17:37:35.000Z","updated_at":"2024-01-18T09:07:38.000Z","dependencies_parsed_at":"2023-10-12T10:08:24.031Z","dependency_job_id":null,"html_url":"https://github.com/umerf52/railway_system_assessment","commit_stats":null,"previous_names":["umerf52/railway_system_assessment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/umerf52/railway_system_assessment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerf52%2Frailway_system_assessment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerf52%2Frailway_system_assessment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerf52%2Frailway_system_assessment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerf52%2Frailway_system_assessment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umerf52","download_url":"https://codeload.github.com/umerf52/railway_system_assessment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerf52%2Frailway_system_assessment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28491520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T00:50:05.742Z","status":"ssl_error","status_checked_at":"2026-01-17T00:43:11.982Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fastapi"],"created_at":"2026-01-17T01:28:37.914Z","updated_at":"2026-01-17T01:28:37.984Z","avatar_url":"https://github.com/umerf52.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Railway Interlocking Assessment\n\nThis is a simple FastAPI server to quickly demonstrate the required functionality.\n\n## Explanation\n- This problem can be looked at as a graph problem.\n- By default, all nodes are bidirectional and reachable from each other.\n- Occupied routes basically tell us which edges to be removed from the graph.\n- Once the edges have been removed, we can check for conflicts by finding a path in the graph between the two nodes. If nodes are reachable, then there is no conflict. If nodes are not reachable, then there is a conflict.\n\n## Solution\n- Instead of reinventing the wheel, I used a library [networkx](https://github.com/networkx/networkx) specialized for working with graph problems.\n- This allowed me to quickly prototype the solution since I don't have to worry about how to represent the nodes and edges of the graph in my code.\n- Similarly, I used the library's built-in function to find a path between two nodes.\n- I created a graph, removed occupied sections from the graph, and then checked for reachability.\n\n## Running the server\n- Install the dependencies using `pip install -r requirements.txt`\n- Run the server using `uvicorn src.server:app --reload`\n\n## Deployed version\n- The server is deployed on Vercel and can be accessed at https://railway-system-assessment.vercel.app/\n\n## Deployment\n- I used Vercel to deploy the server since it allows free usage for hobby projects.\n- I used this guide for deployment: https://abdadeel.medium.com/deploy-fastapi-app-on-vercel-serverless-b9fc35bba74d\n\n## Technical decisions\n- I used FastAPI since it is easy to understand, but can also be scaled to production. Other choices were Flask or Django but they are an overkill for a simple project like this.\n- There might be other approaches to solve this problem, (like directly creating a graph with removed edges) but this approach made logical sense to me.\n- Tests were skipped due to time constraints. Simple tests for successful responses, invalid parameters.\n- Similarly, code can be refactored into separate files for endpoints, graph logic, examples, etc.\n- It was also possible to implement the graph logic myself, but I decided to use a library since it is more robust and tested. Moreover, it allowed me to focus on the problem itself rather than the implementation details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumerf52%2Frailway_system_assessment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumerf52%2Frailway_system_assessment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumerf52%2Frailway_system_assessment/lists"}