Closed crangelsmith closed 3 years ago
Topics to discuss in meeting of 117th August:
VPH framework:
The assignment function:
[
](url)
@crangelsmith please take a look and feel free to edit as you see fit.
In the meeting today (17th Aug), we talked about the following components:
input: Rows with internal_outmigration == True
in:
The relevant columns (sex, age, location, ...) should be selected, converted to meaningful keys for the data structure and finally:
output:
matrix:
Shape: N x d
N: number of rows with `internal_outmigration == True`
d: number of possible destinations
values: weights assigned to each possible destination
output:
vector:
Shape: N x 1
N: number of rows with `internal_outmigration == True`
values: ids of next destination
Notes from meeting on 19 August:
Internal migration matrices are in the ward level. This means the following steps (@kasra-hosseini please feel free to add/comment/modify these):
I'll will try to have all steps implemented in the code (with step 2 and 3 using dummy matrices) before I leave on holiday.
Currently, we use one OD matrix (regardless of age/sex) to assign new MSOAs to migrants.
TODO:
int_migration_pool
to detect correct OD matrices and their rows, this depends on the origin, sex and age. NOTE: as already mentioned, we use one OD matrix now.
The plan is to use IPF to generate one OD matrix for each (age_group, sex). In the internal migration component and by using int_migration_pool
, we should first detect the correct OD matrix (based on age_group and sex), find the relevant rows (based on origins), extract the rows and go to next step.
I also added a new file: https://github.com/alan-turing-institute/vivarium_public_health_spenser/blob/features/44-internal-outmigration/persistant_data/Middle_Layer_Super_Output_Areas__December_2001__Population_Weighted_Centroids.csv
Using this file, we can convert migrant's MSOAs to geographic coordinates, so we can track the locations of migrants. In the following figure, the left column shows origins and the right column shows migrant's destinations.
I had to add a very large file (~100MB) to the repo as well: https://github.com/alan-turing-institute/vivarium_public_health_spenser/blob/features/44-internal-outmigration/persistant_data/OD_matrix_EW_no_intra_flows.csv
Maybe we should remove this from the commit history and upload it somewhere else?
Internal migration implementation based on this document. This is a meta-issue.
The implementation is in the following steps:
[x] Get a "pool" of individuals that migrate from a local region (based on the probability of internal migration here) (PR #45)
[x] Individual that are in that pool get assigned to a new location. (PR #45)
[x] Implement more complex migration matrix (PR #?)
Note: we use
csv2sparse
function inutilities.py
to convert the OD matrices to sparse representations.Refer to #48 , these are already implemented:
scipy.sparse.coo_matrix
to savenpz
files for each OD matrix (in the preprocessing step), we then load these files in the iternal_migration code.MSOA_LAD_indices
with the first column of OD matrices, this should be created in the preprocessing step as the previous steptest_internal_migration
, we downloadpersistant_data/OD_matrix_EW_no_intra_flows.csv
using wget, this should be replaced by the new matrices~