Introduced optimisations to avoid querying the databases when not necessary
This MR alters the ExportHandler
class so that:
- Track is kept of the exposure entity of the previous data unit ID run. If it is the same, then
cost_assumptions
andpeople_distribution
are not retrieved again. - It first checks if the data-unit tile contains any buildings at all (OBM, remainder, aggregated). If there are no buildings at all, then it jumps all the remaining code and goes to the next realisation of the loop (i.e. it does not query the database to obtain building classes, etc).
The test of the ExportHandler
class was extended to cover relevant new processing cases that arise from these changes.
Other minor changes are associated with logging and docstrings, as well as making sure that DatabaseQueries.get_numbers_buildings_for_data_unit_tile
returns floats even when the fields in the database are NULL.
Edited by Cecilia Nievas