Skip to content

Conversation

@Raytesnel
Copy link
Collaborator

initial draft for the endpoint prepare marks.

I put TODO's for the implementation.

i need to look at it again, and see if i missed somthing (like a test or so).

@cfs-data / @SimoneAriens in the docstrings and the description of the input/output schemas i just wrote somthing that could be wrong. can you check if it is okay or missing somthing? after that i can format the docstrings.

@Raytesnel Raytesnel requested a review from snregales January 15, 2026 12:58
@Raytesnel Raytesnel self-assigned this Jan 15, 2026
@Raytesnel Raytesnel marked this pull request as draft January 15, 2026 12:58
Comment on lines +54 to +80
class PrepareMarkResponse(ProcessedDataAccess):
"""Response model for prepared mark data access."""

mark_mat: HttpUrl = Field(
...,
description="Data for the prepared mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/mark.mat"],
alias="mark_mat",
)
processed_mat: HttpUrl = Field(
...,
description="Data for the processed mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/processed.mat"],
alias="processed_mat",
)
profile_mat: HttpUrl = Field(
...,
description="Data for the profile of the prepared mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/profile.mat"],
alias="profile_mat",
)
levelled_mat: HttpUrl = Field(
...,
description="Data for the levelled mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/levelled.mat"],
alias="levelled_mat",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't know if it's already merge, but I created a model for holding just download links. ProcessedDataUrls. there is a lost of precision no key, value pair. just a list of urls.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we make a different PR, il keep this open. to remind me. and close it when a branch /ticket is made


class PrepareMark(BaseParameters):
mark_typ: MarkType = Field(..., description="Type of mark to prepare.")
mask_array: list[list[float]] = Field(..., description="Array representing the mask for the mark.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

we know that mask/mask_array is a 2D array so we can at the most validate that with the tople type for instance I used tuple[tuple[float, ...], tuple[float, ...]] now I know at the minimum that it must be a nested sequence with exactly two sequences nested within it. and all containers are also immutable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i will leave this i think for the implementation. and have small subtasks to fill in,
like make striation pipeline or make more efficient transfer of 2d array etc

@Raytesnel Raytesnel force-pushed the prepare-marks-contract branch from c8f02fd to 46b2438 Compare January 15, 2026 14:58
PREPROCESSOR_ROUTE = "/preprocessor"


class StriationMarks(StrEnum):
Copy link
Collaborator

Choose a reason for hiding this comment

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

these are also defined in scratch-core, can you take the MarkType and CropTypes from there?

Copy link
Collaborator Author

@Raytesnel Raytesnel Jan 15, 2026

Choose a reason for hiding this comment

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

those two are doing 2 different things,
this one has a distinction between 2 marks, impression and striation and a key for the code and value what comes from Java instead of both only as key
when an endpoint gets a str, it is mapped to one of those 2 enums, and we keep the string value of the enum.

the MarkType and CropTypes are enums that has values 1-x. where i still need to do a pattern match to find if it is impression or striation.

but i don't know the purpose of the other exactly. il come back, maybe we can update those. and merge then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looks like the code is not doing anything with those types, we only use .scale function?
so we can merge it then.
but still i like the distinction between what in our code is used and what is agreed on in Java side. for example if the name got little bit different we only need to change the interface of the api and not the core package.

but it is a bit of duplication. @snregales do you have a opinion?

Comment on lines +55 to +79
"""Response model for prepared mark data access."""

mark_mat: HttpUrl = Field(
...,
description="Data for the prepared mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/mark.mat"],
alias="mark_mat",
)
processed_mat: HttpUrl = Field(
...,
description="Data for the processed mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/processed.mat"],
alias="processed_mat",
)
profile_mat: HttpUrl = Field(
...,
description="Data for the profile of the prepared mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/profile.mat"],
alias="profile_mat",
)
levelled_mat: HttpUrl = Field(
...,
description="Data for the levelled mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/levelled.mat"],
alias="levelled_mat",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@SimoneAriens can you give more information on the description. instead of only "Data for <file_name>" I like to have a short summary of what is in the file.

@Raytesnel Raytesnel force-pushed the prepare-marks-contract branch from 46b2438 to 8e3bd6d Compare January 15, 2026 16:12
@Raytesnel Raytesnel force-pushed the prepare-marks-contract branch from 6f12502 to 7c2a9bb Compare January 16, 2026 13:02
@github-actions
Copy link

Diff Coverage

Diff: origin/main..HEAD, staged and unstaged changes

  • src/constants.py (100%)
  • src/extractors/schemas.py (100%)
  • src/preprocessors/controller.py (100%)
  • src/preprocessors/pipelines.py (100%)
  • src/preprocessors/router.py (100%)
  • src/preprocessors/schemas.py (100%)

Summary

  • Total: 88 lines
  • Missing: 0 lines
  • Coverage: 100%

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
. 96% 88%
comparators 100% 100%
container_models 99% 100%
conversion 96% 89%
conversion.leveling 100% 100%
conversion.leveling.solver 100% 75%
conversion.preprocess_impression 99% 92%
extractors 95% 75%
parsers 98% 67%
parsers.patches 89% 60%
preprocessors 100% 100%
processors 100% 100%
renders 98% 50%
utils 91% 75%
Summary 97% (1230 / 1264) 84% (133 / 158)

Minimum allowed line rate is 50%

examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/profile.mat"],
alias="profile_mat",
)
levelled_mat: HttpUrl = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally I think we should stick either with American English or British, but not mix it (e.g. levelled instead of leveled)

examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/mark.mat"],
alias="mark_mat",
)
processed_mat: HttpUrl = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are not returning .mat-files anymore, so we can maybe change the name here to mark_file, processed_file, etc?



class ImpressionMarks(StrEnum):
BREACH_FACE = "breach face impression mark"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we not use = auto() everywhere?

...,
description="Data for the prepared mark.",
examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/mark.mat"],
alias="mark_mat",
Copy link
Collaborator

@cfs-data cfs-data Jan 19, 2026

Choose a reason for hiding this comment

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

alias can be removed here everywhere I think

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.

5 participants