Fix Jore3-Importer export logic for conflicting validity periods between lines and route #137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix jore3-importer logic related to database constraint violations caused by validity period inconsistencies between transformed lines and routes.
In the Jore3 data model, the line itself (the
network_lines
table in the internal database of jore3-importer) has no validity period. Instead, the line-specific headers (network_line_headers
table) have validity periods that do not overlap. Originally, it was thought that a separate line instance would be created for each line header into the Jore4 database. However, it appears that Jore3 route directions (network_route_directions
table) may overlap with multiple line headers. This causes a transformation problem, because in Jore4 the validity period of a route MUST NOT extend further into the past or future than the line to which the route belongs.Basically, there are two options to solve the problem:
In this PR, we have chosen the option (2) to import as much (version) data as possible into Jore4. In the line export SQL, we group the line headers into temporally continuous clusters. The last line header of each cluster is given a Jore4 ID that can be referenced by routes.
Resolves HSLdevcom/jore4#1659
This change is