Open rikukissa opened 5 months ago
JWMRGwDBXK,Ibombo District Office,Location/oEBf29y8JP8,CRVS_OFFICE
So seeding created this
name: Ibombo District Office
valid_from: 1970
valid_to: 27/3/2024
is_valid: true
is_valid
flag is only for demonstrative purposes.
JWMRGwDBXK,Ibombo's District Office,Location/oEBf29y8JP8,CRVS_OFFICE
The existing record was changed to
name: Ibombo District Office
valid_from: 1970
valid_to: 27/3/2024
is_valid: false
New record was written
name: Ibombo's District Office
valid_from: 27/3/2024
valid_to: 1/1/3000
is_valid: true
JWMRGwDBXK,Ibombo's Great District Office,Location/oEBf29y8JP8,CRVS_OFFICE,1/5/2024,1/1/3000
The existing record was changed to
name: Ibombo's District Office
valid_from: 27/3/2024
valid_to: 1/1/3000
is_valid: false
New record was written
name: Ibombo's Great District Office
valid_from: 1/5/2024
valid_to: 1/1/3000
is_valid: true
- [ ] Add an example script to country config service for updating locations: 2 days
- Fetches a list of locations
- If any item of location list has changed, (so one of the following fields change name, partOf):
- Update the location with details given by country config
- If items have been removed: invalidate the existing location by changing its status to
inactive
@Zangetsu101 @rikukissa This could make sense to be within core in data-seeder. A yarn seed:locations
script similar to the current location seeding. data-seeder already has the means to fetch the locations from country-config and while it does stuff via the temporary super user, this seeding could require setting a token
The issue with the super user is that we deactivate it as soon as seeding's finished
The groundwork for allowing to change location structures is done. Now we only save the leaf level locations and the full path of a location is then fetched from ground up.
For the location configuration to be a documented and configurable feature, we depend on a real need from a country/installation. There are options for how to allow configuring the locations (UI, or only a Postman example request, or a GitHub Action which re-seeds the locations...), but we are missing a real-world use case to finish the design of the feature
Remove eventJurisdictionIds from search; they are not referenced in very many places
ElasticSearch rows
Case 2 needs to be refactored when the actual UI/location editing feature is created. I'd say it's a small issue though, as the searching itself already uses leaf level locations, and we simply can then reindex the ElasticSearch to only save the leaf level.
Description
So in other words, make it possible to correct existing details. In this task we build the foundation for temporality of Locations.
Acceptance criteria
Notice that in this first phase, for location information queries to Hearth, we can still heavily rely on the Location / Location_history functionality and none of the MongoDB queries for fetching location details should change. If a location name or partOf is changed, the previous version gets pushed to Location_history and we don't have to worry about it too much.
Known limitations
Technical tasks
This model changes location details directly and does not provide "temporality". If you change location name today, even records from 10 years ago show the new location name. Same with if you move the location to a new parent location.
(locationId: LocationID) => Array<{locationId: LocationID, validFrom: Date, validUntil: Date}>
validFrom
can be hard-coded to 1/1/1970validUntil
can be hard-coded to 1/1/3000in_complete_fields
so no need to change any querieseventJurisdictionIds
from search; they are not referenced in very many placesinactive