-
Notifications
You must be signed in to change notification settings - Fork 0
Prepare marks contract #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| 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", | ||
| ) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snregales said:
we will (try) to use EncodedBytes pydantic type for mask.
https://docs.pydantic.dev/latest/api/types/#pydantic.types.Base64UrlEncoder.get_json_format
There was a problem hiding this comment.
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
c8f02fd to
46b2438
Compare
| PREPROCESSOR_ROUTE = "/preprocessor" | ||
|
|
||
|
|
||
| class StriationMarks(StrEnum): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
| """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", |
There was a problem hiding this comment.
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.
46b2438 to
8e3bd6d
Compare
6f12502 to
7c2a9bb
Compare
Diff CoverageDiff: origin/main..HEAD, staged and unstaged changes
Summary
|
Minimum allowed line rate is |
| examples=["http://localhost:8000/preprocessor/files/surface_comparator_859lquto/profile.mat"], | ||
| alias="profile_mat", | ||
| ) | ||
| levelled_mat: HttpUrl = Field( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
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.