june.groups.hospital.Hospitals¶
-
class
june.groups.hospital.
Hospitals
(hospitals: List[Hospital], neighbour_hospitals: int = 5, box_mode: bool = False, ball_tree=True) Create a group of hospitals, and provide functionality to locate patients to a nearby hospital. It will check in order the first
`neighbour_hospitals`
, when one has space available the patient is allocated to it. If none of the closest ones has beds available it will pick one of them at random and that hospital will overflow- hospitals:
list of hospitals to aggrupate
- neighbour_hospitals:
number of closest hospitals to look for
- box_mode:
whether to run in single box mode, or full simulation
-
__init__
(hospitals: List[Hospital], neighbour_hospitals: int = 5, box_mode: bool = False, ball_tree=True) Create a group of hospitals, and provide functionality to locate patients to a nearby hospital. It will check in order the first
`neighbour_hospitals`
, when one has space available the patient is allocated to it. If none of the closest ones has beds available it will pick one of them at random and that hospital will overflow- hospitals:
list of hospitals to aggrupate
- neighbour_hospitals:
number of closest hospitals to look for
- box_mode:
whether to run in single box mode, or full simulation
-
_make_member_ids_dict
(members) Makes a dictionary with the ids of the members.
-
add
(group)
-
clear
()
-
classmethod
create_hospital_from_df_row
(area, row)
-
classmethod
for_box_mode
()
-
classmethod
for_geography
(geography, filename: str = PosixPath('/home/sadie/JUNE/data/input/hospitals/trusts.csv'), config_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/groups/hospitals.yaml'))
-
classmethod
from_file
(filename: str = PosixPath('/home/sadie/JUNE/data/input/hospitals/trusts.csv'), config_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/groups/hospitals.yaml')) → june.groups.hospital.Hospitals Initialize Hospitals from path to data frame, and path to config file.
- filename:
path to hospital dataframe
- config_filename:
path to hospital config dictionary
Hospitals instance
-
get_closest_hospitals
(coordinates: Tuple[float, float], k: int) → Tuple[float, float] Get the k-th closest hospital to a given coordinate
- coordinates:
latitude and longitude
- k:
k-th neighbour
ID of the k-th closest hospital
-
get_closest_hospitals_idx
(coordinates: Tuple[float, float], k: int) → Tuple[float, float] Get the k-th closest hospital to a given coordinate
- coordinates:
latitude and longitude
- k:
k-th neighbour
ID of the k-th closest hospital
-
get_from_id
(id)
-
get_spec
() → str Returns the speciailization of the super group.
-
init_hospitals
(hospital_df: pandas.core.frame.DataFrame) → List[june.groups.hospital.Hospital] Create Hospital objects with the right characteristics, as given by dataframe.
- hospital_df:
dataframe with hospital characteristics data
-
init_trees
(hospital_coordinates: numpy.array) → sklearn.neighbors._ball_tree.BallTree Reads hospital location and sizes, it initializes a KD tree on a sphere, to query the closest hospital to a given location.
- hospital_df:
dataframe with hospital characteristics data
Tree to query nearby schools
-
property
group_spec
-
property
member_ids