{"id":26703474,"url":"https://github.com/jakebrehm/referral-network","last_synced_at":"2026-04-21T22:35:22.717Z","repository":{"id":155728273,"uuid":"622046202","full_name":"jakebrehm/referral-network","owner":"jakebrehm","description":"🔍 A Flask application that helps identify the bottlenecks in a specialty referral network.","archived":false,"fork":false,"pushed_at":"2023-05-03T19:36:00.000Z","size":1807,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T03:34:26.674Z","etag":null,"topics":["data-science","flask","healthcare","network-analysis","network-science","python","visualization","web-application"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakebrehm.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}},"created_at":"2023-04-01T01:09:30.000Z","updated_at":"2024-05-31T16:47:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f1a2b01-dfde-4911-b2fb-1c6c9df8202e","html_url":"https://github.com/jakebrehm/referral-network","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jakebrehm/referral-network","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebrehm%2Freferral-network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebrehm%2Freferral-network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebrehm%2Freferral-network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebrehm%2Freferral-network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakebrehm","download_url":"https://codeload.github.com/jakebrehm/referral-network/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebrehm%2Freferral-network/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263427299,"owners_count":23464840,"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":["data-science","flask","healthcare","network-analysis","network-science","python","visualization","web-application"],"created_at":"2025-03-27T03:30:18.677Z","updated_at":"2026-04-21T22:35:17.687Z","avatar_url":"https://github.com/jakebrehm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/jakebrehm/referral-network/master/img/logo.png\" alt=\"Referral Network Logo\"/\u003e\n\u003c/div\u003e\n\n\u003ch4 align=\"center\"\u003eCan we visualize the bottlenecks that occur in the specialty referral network so that opportunities for improvement can be further explored?\u003c/h4\u003e\n\n\u003chr\u003e\n\n## Table of contents\n\n* [Introduction](#introduction)\n* [Getting set up](#getting-set-up)\n    * [Required dependencies](#required-dependencies)\n    * [Installing the dependencies](#installing-the-dependencies)\n* [Starting the web application](#starting-the-web-application)\n* [Debug mode](#debug-mode)\n* [Formatting the input data](#formatting-the-input-data)\n* [About the visualization](#about-the-visualization)\n    * [Node color](#node-color)\n    * [Node sizing](#node-sizing)\n    * [Edge color](#edge-color)\n* [Filtering the visualization](#filtering-the-visualization)\n    * [By minimum referrals](#by-minimum-referrals)\n    * [By department](#by-department)\n    * [By node pair efficiency](#by-node-pair-efficiency)\n* [Flask app demo](#flask-app-demo)\n* [Future improvements](#future-improvements)\n* [Contributors](#contributors)\n* [Acknowledgements](#acknowledgements)\n\n\u003chr\u003e\n\n## Introduction\n\nAt the University of Rochester Medical Center (UR Medicine), referrals typically originate in primary care and are sent out to the appropriate internal and external specialty practices. Ideally, these referrals are sent out upon request and processed immediately, without too much hassle for the medical staff or the patient. Unfortunately, it is not uncommon for bottlenecks to occur in the referral pipeline, leading to extra work for the medical team and added uncertainty for the patient. In this project, our goal is to be able to identify where these bottlenecks are occurring—i.e., which departments and specialties are least efficient, and if there are any referral pathways that are convoluted in particular. We worked toward this objective through the use of an intuitive network visualization that is embedded in a web application.\n\n## Getting set up\n\nThe source code can be viewed on GitHub [here](https://github.com/jakebrehm/referral-network).\n\n### Required dependencies\n\nThis project currently requires a minimum of *Python 3.10*.\n\nDependencies are handled by the `poetry` package, primarily meant to allow for easy dependency management, but the noteable dependencies are:\n\n- [pandas](https://github.com/pandas-dev/pandas)\n- [networkx](https://github.com/networkx/networkx)\n- [plotly](https://github.com/plotly/plotly.py)\n- [Flask](https://github.com/pallets/flask)\n\n### Installing the dependencies\n\nThe first step to setting up this project is to clone this repository. To do this, open a command line instance and change your working directory to the directory you'd like to clone the repository to.\n\n```\ncd path/to/clone/repository/to\n```\n\nThen, use the following command to clone the repository.\n\n```\ngit clone https://github.com/jakebrehm/referral-network.git\n```\n\nAssuming Python is already installed, make sure that the `poetry` package is installed as well. This package is primarily for easily managing dependencies.\n\n```\npip install poetry\n```\n\nUse `pip3` instead of `pip` if you also have Python 2 installed on your machine (this is typically the case by default for certain operating systems like MacOS).\n\nOnce `poetry` has been installed, use the following command to install the project dependencies in a virtual environment.\n\n```\npoetry install\n```\n\nThis virtual environment will be stored in an out-of-the-way location. If you'd prefer to store it directly in the project directory, use the following command.\n\n```\npoetry config virtualenvs.in-project true\n```\n\n## Starting the web application\n\nTo activate the virtual environment that was initialized in [Installing the dependencies](#installing-the-dependencies), use the following command.\n\n```\npoetry shell\n```\n\nOnce the virtual environment has been activated, you can start the Flask application by running `app.py`, which is located in the `referral_network` directory.\n\n```\npython referral_network/app.py\n```\n\nTo deactivate the virtual environment and exit the shell at any point, type `exit`. To deactivate the virtual environment without leaving the shell, type `deactivate`, although this usage is much less common.\n\n## Debug mode\n\nTo run the Flask application in debug mode, which is recommended if not being used in a production environment until the project is in a more stable state, use the `-d` or `--debug` command line argument.\n\n```\npython referral_network/app.py -d\n```\n\nThis option will display a page that allows the user to determine where the error is occurring. It will also send all logging messages to the console instead of to a file that is stored on disk.\n\n## Formatting the input data\n\nThe input data must be in *CSV* format with a header, and include the columns that match the schema shown in the table below.\n\n| Column Name | Date Type | Description |\n| ----------- | --------- | ----------- |\n| Referred From | integer | Anonymized ID of referring department |\n| Referred To | integer | Anonymized ID of department being referred to |\n| Days to Schedule | integer | Number of days to schedule the referral |\n\n## About the visualization\n\nCertain aesthetic choices were made when creating the visualization in order to provide a more intuitive and meaningful experience; the subsections below describe these choices.\n\nNote that hovering over nodes and edges will provide more information about that node or edge.\n\n### Node color\n\nThe color of each node in the graph is meant to show at a glance in which direction referrals are flowing.\n\n| Node color | Meaning |\n| - | - |\n| Brown | Only makes referrals |\n| Yellow | Only receives referrals |\n| Cyan | Makes and receives referrals |\n\nThese colors were specifically selected to take into account potential color blind users.\n\n### Node sizing\n\nNode size is determined by the degree of the node; in this case, this means the number of referrals that are associated with a node.\n\nNodes that have a non-zero in-degree and a zero out-degree, i.e., only *makes* referrals, will be sized according to the in-degree value.\n\nNodes that have a zero in-degree and a non-zero out-degree, i.e., only *receive* referrals, will be sized according to the out-degree value.\n\nNodes that have non-zero in-degrees and out-degrees will be sized according to the sum of these values.\n\nEssentially, node sizing is meant to work in conjunction with node coloring to illustrate how important and central a node is in the network.\n\n### Edge color\n\nThe color of an edge is meant to depict how long it takes to schedule a referral between two nodes. In this case, *median* is the aggregation statistic that is used.\n\n| Edge color | Median days to schedule |\n| - | - |\n| Green | \u003c 15 |\n| Orange | 16 - 50 |\n| Red | \u003e 51 |\n\nEssentially, the darker an edge is, the longer it takes for referrals to be scheduled between those two nodes.\n\nCurrently, we are restricting the tooltip values to only nodes where the number of referrals is above a certain dynamically-calculated threshold.\n\n## Filtering the visualization\n\nThe following subsections describe the features of the visualization the can be customized (i.e., that controls appear in the sidebar to manipulate).\n\n### By minimum referrals\n\n*Minimum referrals* is the minimum number of referrals made between two nodes for it to appear in the visualization.\n\n### By department\n\nIt is possible to filter the visualization by department, i.e., only referrals that are related to the specified department will be considered.\n\n### By node pair efficiency\n\n*Node pair efficiency* is a measure of how efficient a node pair is in processing referrals. It is calculated by dividing the total number of referrals made between two nodes by the total number of days needed to schedule those referrals. Then, once all node pair efficiencies have been calculated, min-max normalization is applied; thus, an efficiency of 0 represents the least efficient node in terms of processing referrals, where 1 indicates the opposite.\n\n## Future improvements\n\nThe following potential improvements are listed in no particular order.\n\n- Allow support for uploading Excel spreadsheets in addition to CSV files\n- Add tooltips to UI items such as the customizability controls\n- Implement a memory of the visualization settings between sessions\n- Added more customizability to the visualization via the sidebar\n- Should check if CSV file is formatted correctly, and return an error if not\n- Need to sanitize input, e.g., negative minimum referral values should be prohibited\n\n\u003chr\u003e\n\n## Contributors\n\n- **Jake Brehm** - [Email](mailto:mail@jakebrehm.com) | [LinkedIn](http://linkedin.com/in/jacobbrehm) | [Github](http://github.com/jakebrehm)\n- **Sayan Swar** - [Email](mailto:sayankrswar@hotmail.com) | [LinkedIn](http://linkedin.com/in/sayankrswar) | [Github](http://github.com/skswar)\n\n## Acknowledgements\n\nWe thank [Dr. Kathleen Fear](https://www.linkedin.com/in/kathleen-fear/) (UR Medicine) and [Dr. Justin Zelenka](https://www.urmc.rochester.edu/people/29494170-justin-zelenka) (UR Medicine) for providing the opportunity to conduct research on this subject, providing data, and regularly engaging with us in helpful discussions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebrehm%2Freferral-network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakebrehm%2Freferral-network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebrehm%2Freferral-network/lists"}