Skip to content

Conversation

@hanstrompert
Copy link
Member

No description provided.

Copy link
Contributor

@Mark90 Mark90 left a comment

Choose a reason for hiding this comment

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

There's still plenty of surf dependencies in the code at the moment that need to be handled.
I'm also wondering how this aligns with PR #53 from @tvdven ?

else:
return False, f"date `{date}` has invalid length"

return True, None
Copy link
Contributor

Choose a reason for hiding this comment

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

This could rely entirely on the validation by datetime.datetime.strptime

VALID_DATE_FORMATS = {
    4: '%Y', 
    6: '%Y%m', 
    8: '%Y%m%d',
}

def valid_date(date: str) -> tuple[bool, str | None]:
    if not (date_format := VALID_DATE_FORMATS.get(len(date))):
        return False, f"Invalid date length, expected one of: {list(VALID_DATE_FORMATS)}"

    try:
        _ = datetime.strptime(date, date_format)
        return True, None
    except ValueError as exc:
        return False, f"Invalid date for format {date_format!r}: {exc}"

Comment on lines +29 to +33
from surf.config.service_port_tags import SN8_PORT_TAGS_AGGSP, SN8_PORT_TAGS_MSC, SN8_PORT_TAGS_SP_ALL
from surf.db import SurfSubscriptionTable
from surf.forms.validator.service_port import service_port
from surf.products.product_types.sn8_nsistp import Nsistp, NsistpInactive
from surf.utils.exceptions import DuplicateValueError, FieldValueError
Copy link
Contributor

Choose a reason for hiding this comment

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

These surf imports should have been removed probably?

Comment on lines +169 to +170
def nsistp_fill_sap(subscription: NsistpInactive, service_ports: list[dict]) -> None:
sp = one(service_ports)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be cleaner to do the one(service_ports) selection in the caller function


def _get_nsistp_subscriptions(subscription_id: UUID | None) -> Iterator[Nsistp]:
query = (
select(SurfSubscriptionTable.subscription_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can probably just replace SurfSubscriptionTable with SubscriptionTable (from orchestrator.db.models)

Copy link
Contributor

Choose a reason for hiding this comment

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

Think we want to remove sn8 from the folder structure



def nsistp_service_port(current: list[State] | None = None) -> type:
return service_port(
Copy link
Contributor

Choose a reason for hiding this comment

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

This surf validator is not present in the example-orchestrator. We'd need a port of that.

@Mark90 Mark90 marked this pull request as draft October 14, 2025 13:59
@hanstrompert
Copy link
Member Author

Like the first commit message already stated, this is the 'SURF NSISTP implementation to be used as basis'. This is the original, very SURF specific, code. But another pull request was made for the refactored code. I suggest we close this one.

@Mark90 Mark90 closed this Oct 15, 2025
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.

[Feature]: add NSISTP product and workflows to example orchestrator

2 participants