Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alimp5/bb50e4a2643c62cad3571702253ecce2 to your computer and use it in GitHub Desktop.
Save alimp5/bb50e4a2643c62cad3571702253ecce2 to your computer and use it in GitHub Desktop.
Example of Proxy Model InfectionRateVisualization
from visualizations.models import Visualization
class InfectionRateVisualization(Visualization):
class Meta:
proxy = True
def from_data(csvfile):
department_instances = []
infection_type = []
with open csvfile as file:
if file["department"] and file["type"]:
department_instances = np.array(file["department"])
infection_type = np.array(file["type"])
else:
return IncompleteDataException("Please include a department and a type column in your CSV.")
map = HeatMap(list(zip(department_instances, infection_type)))
return map.to_svg()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment