Skip to content

Added function that searches for proposals by PI name#249

Open
Juan Marulanda (jmaruland) wants to merge 8 commits into
NSLS2:mainfrom
jmaruland:add-find-proposals-function
Open

Added function that searches for proposals by PI name#249
Juan Marulanda (jmaruland) wants to merge 8 commits into
NSLS2:mainfrom
jmaruland:add-find-proposals-function

Conversation

@jmaruland

Copy link
Copy Markdown

This PR adds a function that will allow BL staff to search in tiled for proposals in by PI name and cycle (optional). The goal is to allow BL staff to import this method in their bsui environment and have this function at hand during their experiments.
This function was tested with the OPLS and SMI catalogs

@jmaruland

Copy link
Copy Markdown
Author

After receiving some feedback from BL staff, I added an additional input parameter that allows optional queries. This is intended for other filed in the start document that BL staff would find useful to search for proposals. I narrowed down the search to string and numerical types; other data types are not included.
E.g.:

>>> find_proposals(
        tiled_reading_client,
        "Smith",
        cycle="2026-1",
        optional_queries={"exposure_time": (">", 10)},
        show_title=True,
    )

@mrakitin Max Rakitin (mrakitin) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's a useful feature.

@jwlodek

Jakub Wlodek (jwlodek) commented May 28, 2026

Copy link
Copy Markdown
Contributor

Could we add some unit tests that cover this functionality? Also type hints for the function arguments would be nice

@danielballan

Copy link
Copy Markdown
Contributor

Juan Marulanda (@jmaruland) let me know that some queries time out (against SQL-backed catalogs). Better indexes are needed to support this. We aim to add those in the next maintenance (June 16) and it does not need to be a blocker for merging this PR.

I agree with Jakub Wlodek (@jwlodek) that it's worth adding unit tests and type hints.

@jmaruland

Copy link
Copy Markdown
Author

Thanks for all the comments to improve this PR. I will add all these features next.

Dan Allan (@danielballan) my tests using the sql-backed catalogs have not passed this line that involves the Like() method and unfortunately, this is the only line that I cannot test with the mongo-backed catalogs.
https://github.com/jmaruland/nslsii/blob/80b0b2e2ecfd1d66101baeaaf64f4024cab05eb6/nslsii/proposals.py#L69

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.

4 participants