How Addresses (should) work currently
- Addresses are a standalone model that can be linked to a Partner or Event.
- Each Address record is unique, meaning even if multiple things are at the same Address, it will appear in the database multiple times. (This has changed from earlier versions where we unified the addresses)
- Neighbourhoods are imported based on data from the UK census office. They are timestamped to a specific year, currently 2019.
- We currently have no plan to update these to the latest boundaries. This may begin to cause issues as our internal representation diverges from the current reality. This is a known issue with our app we need to address.
Addresses → Neighbourhoods
For Partners “Address resolution” is done as part of the validation. It only runs if the postcode has changed value.
- The postcode is matched to a regex to make sure it is present and looks correct
- The geocoder is called and if no match for that postcode is found a problem is flagged for the user to deal with
- We lookup the geocoder response and map it to the correct neighbourhood. If a neighbourhood is not found it is flagged as a problem for the user (it should be our problem as this means our neighbourhood database is out of date).
Partners → Addresses → Neighbourhoods
- (this is the same as above)
When a Partner is created or updated that has an Address, the Partner gets linked to a Neighbourhood through the Address. This then allows for all the Partners in one Neighbourhood to be returned.
Events → (Partners?) → Addresses → Neighbourhoods
- Calendars have a “location resolution strategy” that can be one of
- Event Get the location of this event from the address field on the source event. This is for area calendars, or organisations with no solid base.
- Default location Every event is in one location (set below). The address field on the source calendar is ignored.
- Room Number Every event is on one location (set below), and the address field is used to store a room number.
- Event Override Every event is in one location (set below), unless the address field is set to another location
- No Location Events imported will have no location information set in PlaceCal, even if it is present on the remote feed
- Online Only Events imported will have no physical location information set in PlaceCal, even if it is present on the remote feed, but will maintain the online information
- When an Event is created with an Address directly, the Event gets linked to a Neighbourhood through the Address.
- Events without their own Address inherit their Partner’s Address and get linked to the Neighbourhood that way.
- This then allows for all the Events in a Neighbourhood either with their own address or at the address of a partner to be returned.