Skip to content
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

Search basic #15

Open
wants to merge 14 commits into
base: paralell_normalization
Choose a base branch
from
Open

Search basic #15

wants to merge 14 commits into from

Conversation

noctillion
Copy link
Contributor

Add endpoints to retrieve paginated expression data raw and normalized via GET. Retrieve normalized and raw expression information via POST, by experiment, gene_id and sample_id

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in the expression router instead, with no /query prefix

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be in the expressions router, since it is has the /expressions path.

sample_id: str = Field(..., min_length=1, max_length=255, description="Sample ID")
experiment_result_id: str = Field(..., min_length=1, max_length=255, description="Experiment result ID")
count: float = Field(..., description="Expression count")
method: str = Field(..., description="Method used to calculate the expression count")
Copy link
Contributor

Choose a reason for hiding this comment

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

method: MethodEnum = Field(MethodEnum, ...)

getmm_count: Optional[float] = None


class GeneExpressionData(BaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a specific reason to only include one count?

getmm = "getmm"


class QueryParameters(BaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to ExpressionQueryBody.
The term "query parameters" refers to query params that are included in the URL, these are in a POST's body so we should avoid confusion.

Comment on lines 64 to 74
page: int = Field(
1,
ge=1,
description="Page number for pagination (must be greater than or equal to 1)",
)
page_size: int = Field(
100,
ge=1,
le=1000,
description="Number of records per page (between 1 and 1000)",
)
Copy link
Contributor

@v-rocheleau v-rocheleau Dec 19, 2024

Choose a reason for hiding this comment

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

Would be nice to have this bundled in a model. Something like this:

class PaginatedRequest(BaseModel):
    page: int = Field(..., ge=1, description="Current page number")
    page_size: int = Field(..., ge=1, le=1000, description="Number of records per page")

# extends PaginatedRequest
class PaginatedRespone(PaginatedRequest):
    total_records: int = Field(..., ge=0, description="Total number of records")
    total_pages: int = Field(..., ge=1, description="Total number of pages")

class SomePaginatedQuery(PaginatedRequest):
    ...

class SomePaginatedResponse(PaginatedRespone):
    ...

This way we reuse the same model for requests or responses, and we have less code duplication!

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