Locations data setup
Location data setup module.
Module contains the following functions
insert_default_data copy_files_from_directory location_data_setup location_data_cleanup download_location_data_file extract_location_data_file split_location_data_file
copy_files_from_directory(old_directory, new_directory)
Copy a file.
Source code in report_generator/project_setup/locations_data_setup.py
110 111 112 | |
default_data_setup(dir_path, data_path)
Sets up the projects default data.
Downloads default data file from git repository and extracts it into the projects data directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path |
str
|
The path to the project directory |
required |
data_path |
str
|
The path to the data directory |
required |
Source code in report_generator/project_setup/locations_data_setup.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
download_default_data(project_dir)
Download the default project data.
Downloads the default data zip file from the project git repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_dir |
str
|
The project directory for the files to be downloaded into. |
required |
Source code in report_generator/project_setup/locations_data_setup.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
download_location_data_file(location_dir)
Download location data files.
Download location data file from the geocodes website.
Source code in report_generator/project_setup/locations_data_setup.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
extract_default_data(data_zip_path, data_path)
Unzips default data file.
Takes the default data zip file and uses zipf to extract it to the projects data directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_zip_path |
str
|
Path to the default data zip file. |
required |
data_path |
str
|
Path to the projects data directory |
required |
Source code in report_generator/project_setup/locations_data_setup.py
95 96 97 98 99 100 101 102 103 104 105 106 107 | |
extract_location_data_file(new_locations_path, location_data_zip_path)
Extract location data.
Source code in report_generator/project_setup/locations_data_setup.py
158 159 160 161 162 163 164 165 166 | |
insert_default_data(dir_path)
Insert default data.
Inserts default data files into the data folder by copying files from the packages data file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path |
str
|
String path to the project directory. |
required |
Source code in report_generator/project_setup/locations_data_setup.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
location_data_cleanup(locations_path, locations_data_file_path)
Cleanup unneeded location data.
Source code in report_generator/project_setup/locations_data_setup.py
129 130 131 132 133 134 135 136 137 | |
location_data_setup(new_locations_path)
Location Data Setup.
Source code in report_generator/project_setup/locations_data_setup.py
115 116 117 118 119 120 121 122 123 124 125 126 | |
split_location_data_file(locations_path)
Split location data into smaller files.
Source code in report_generator/project_setup/locations_data_setup.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |