pepkit / pephub

A web API and database for biological sample metadata
https://pephub.databio.org
BSD 2-Clause "Simplified" License
13 stars 2 forks source link

Consolidating tags #310

Open khoroshevskyi opened 1 month ago

khoroshevskyi commented 1 month ago

Right now, we treat namespace/name:tag as completely different projects.

What if we consolidate all name:tag entries to name, and from the project level, we retrieve the desired tag of the project?

e.g. image

This 2 project in namespace page would be just ONE project.

Also, if user doesn't know tag of the project, then user can access project, even if there is only one existing tag.

nleroy917 commented 1 month ago

Yeah this makes the most sense to me. This is actually how dockerhub does it. Check out the pephub docker image

image

It has a tags tab:

image

So maybe we add a dropdown on a project page and just let the user pick a tag

nleroy917 commented 1 month ago

An idea is a dropdown where a user can select the tag (defaults to default) unless query param is specified:

image
nleroy917 commented 1 month ago

While I'm looking at it, I propose getting rid of the blue schema tag it doesn't seem to add anything and bloats it a bit

khoroshevskyi commented 1 month ago

and instead of tag, annotation return model will have tags, with available tags

class AnnotationModel(BaseModel):
    """
    Project Annotation model. All meta metadata
    """

    namespace: Optional[str]
    name: Optional[str]
    **tags: Optional[str]**
    is_private: Optional[bool]
    number_of_samples: Optional[int]
    description: Optional[str]
    last_update_date: Optional[str]
    submission_date: Optional[str]
    digest: Optional[str]
    pep_schema: Optional[str]
    pop: Optional[bool] = False
    stars_number: Optional[int] = 0
    forked_from: Optional[Union[str, None]] = None
nleroy917 commented 1 month ago

yeah I like this idea -- this makes a lot of sense. Can we leverage this to get rid of these query params too?

image

Here is an example route:

@project.get(
    "/views",
    summary="get list of views for a project",
    tags=["views"],
    response_model=ProjectViews,
)
def get_views(
    namespace: str,
    project: str,
    tag: str = DEFAULT_TAG,
    agent: PEPDatabaseAgent = Depends(get_db),
):
    return agent.view.get_views_annotation(namespace, project, tag=tag)
nleroy917 commented 2 weeks ago

@khoroshevskyi What do you think about this one? Any progress made to the backend?