.

.

.

.

.

HealthyNumerics

HealthPoliticsEconomics | Quant Analytics | Numerics

A dynamic map of Switzerland's 586 hospital locations


import os
import requests
import numpy as np
import pandas as pd
import networkx as nx
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.colors as colors

from IPython.display import Image

import folium
from folium import plugins
from folium.plugins import MarkerCluster
from collections import namedtuple

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="specify_your_app_name_here")

Spitäler der Schweiz

df0 = pd.read_excel('Daten//psc_SpitalStandorte_V2016_V4.xlsx')  # ,header=None
#df0.head()
xM, yM = df0['xcoord'].mean(), df0['ycoord'].mean()
map_sp1 = folium.Map(location=[xM, yM], zoom_start=8)
mc = MarkerCluster()

#creating a Marker for each point in df_sample. Each point will get a popup with their zip
for ir, row in enumerate(df0.itertuples()):
    popupText = row.Inst+',  '+row.Adr_Standort+',  '+row.Ort_Standort
    popupPoint = folium.Popup(folium.IFrame(popupText, width = 200, height = 100  ))   # , height = 150
    mc.add_child(folium.Marker(location=[row.xcoord, row.ycoord],
                               popup=popupPoint, 
                               icon= folium.Icon(prefix='fa', icon='fa-h-square', color=row.color),
                              ) )
map_sp1.add_child(mc)

map_sp1
clinic_type_color = np.array([
    ['K111', '#ff3300', 'darkred',    'akut 1', 'Allgemeinspital, Zentrumsversorgung (Niveau 1, Universitätsspital)'],
    ['K112', '#ff3300', 'darkred',    'akut 2', 'Allgemeinspital, Zentrumsversorgung (Niveau 2)'],
    ['K121', '#ff6600', 'red',        'akut 3', 'Allgemeinspital, Grundversorgung (Niveau 3)'],
    ['K122', '#ff6600', 'red',        'akut 4', 'Allgemeinspital, Grundversorgung (Niveau 4)'],
    ['K123', '#ff6600', 'red',        'akut 5', 'Allgemeinspital, Grundversorgung (Niveau 5)'],
    ['K211', '#0033cc', 'darkblue',   'psyc 1', 'Psychiatrische Klinik (Niveau 1)'],
    ['K212', '#0066ff', 'blue',       'psyc 2', 'Psychiatrische Klinik (Niveau 2)'],
    ['K221', '#00ff00', 'lightgreen', 'rehab',  'Rehabilitationsklinik'],
    ['K231', '#ff3399', 'darkpurple', 's chir', 'Spezialklinik: Chirurgie'],
    ['K232', '#cc3399', 'purple',     's gyn',  'Spezialklinik: Gynäkologie / Neonatologie'],
    ['K233', '#cc3399', 'pink',       's paed', 'Spezialklinik: Pädiatrie'],
    ['K234', '#9933ff', 'darkgreen',  's geri', 'Spezialklinik: Geriatrie'],
    ['K235', '#cc9900', 'lightgray',  's div',  'Spezialklinik: Diverse']
    ])
map_sp1.save(os.path.join('Resultate', 'DynamicMap_Spitalstandorte_2016'))