Skip to content

Resolve Mentz line versions, fix South Tyrolian SSP ids#113

Draft
leonardehrenfried wants to merge 16 commits into
MMTIS:binary_relation_serializerfrom
leonardehrenfried:mentz-line-versions
Draft

Resolve Mentz line versions, fix South Tyrolian SSP ids#113
leonardehrenfried wants to merge 16 commits into
MMTIS:binary_relation_serializerfrom
leonardehrenfried:mentz-line-versions

Conversation

@leonardehrenfried

Copy link
Copy Markdown

Hi @skinkie,

thanks for the constructive meeting the other day. Lets try if we can collaborate because NeTEx tooling is sorely missing.

This PR adds the fix script for rewriting the Mentz line versions into new operating periods. There are very likely follow ups PRs coming but this is already good enough for code review.

It also adds another script for rewriting some South Tyrolian IDs.

cc @rcavaliere @clezag

@skinkie skinkie self-requested a review May 20, 2026 10:21
Comment thread fix/resolve_mentz_line_versions.py Outdated
Comment thread fix/resolve_mentz_line_versions.py Outdated
Comment thread fix/resolve_mentz_line_versions.py Outdated
Comment thread fix/resolve_mentz_line_versions.py Outdated
Comment thread fix/resolve_mentz_line_versions.py
existing_period: UicOperatingPeriod | None = None
if dta is not None:
period_ref = dta.uic_operating_period_ref_or_operating_period_ref_or_operating_day_ref_or_date
if hasattr(period_ref, 'ref'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must check type, not just the attribute.

updated_journeys: list[ServiceJourney] = []
created: dict[tuple[str, str | None, str], str] = {}

for line_id, line_versions in lines.items():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this can be more elegant.

Comment thread fix/resolve_mentz_line_versions.py
Comment thread fix/rewrite_sta_ssp_ids.py
Comment thread fix/rewrite_sta_ssp_ids.py Outdated
print(f"Inserting {len(new_ssps)} renamed ScheduledStopPoints")
# TODO: delete the old ScheduledStopPoint objects (no delete API available yet)

db.insert_any_object_on_queue(txn, updated)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more elegant way is to have a generator function here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed this over here: #114

Lets get this merged first.

@leonardehrenfried leonardehrenfried marked this pull request as draft May 20, 2026 10:42
Comment thread transformers/epip.py Outdated
@leonardehrenfried

Copy link
Copy Markdown
Author

I will temporarily make this into a draft so I can tests the changes I (well Claude) made. I will re-request a review when I'm done. Thanks so far.

@skinkie

skinkie commented May 20, 2026

Copy link
Copy Markdown
Contributor

@leonardehrenfried maybe splice up the scheduled stop point part too?

@leonardehrenfried

Copy link
Copy Markdown
Author

I don't think I understand what you mean with "splice". Send it in a separate PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants