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

Add functionality to fetch rigs with a partial id #304

Closed
mochic opened this issue Dec 5, 2024 · 1 comment · Fixed by #335
Closed

Add functionality to fetch rigs with a partial id #304

mochic opened this issue Dec 5, 2024 · 1 comment · Fixed by #335
Assignees

Comments

@mochic
Copy link

mochic commented Dec 5, 2024

Based on the current workflow of the dynamic routing project, it can be hard to know the full rig_id of rig metadata. When fetching the rig metadata from the api we query slims based on ReferenceData name which also happens to be rig_id.

It would be nice if we could fetch rig metadata from this service using a partial rig_id.

This is appears to be a feature that slims can support so I think this is a feature the api can support:

import json
from slims import criteria

from aind_slims_api import SlimsClient, models


client = SlimsClient()

metadata_reference = client.fetch_model(
    models.SlimsMetadataReference,
    criteria.contains("name", "EPHYS1_OPTO"),
)

attachment = client.fetch_attachment(
    metadata_reference,
)

content = client.fetch_attachment_content(attachment)

print(
    json.dumps(
        content.json(),
        indent=4,
        sort_keys=True,
    )
)
@mochic
Copy link
Author

mochic commented Dec 12, 2024

The aind_slims_api snippet attached to this issue doesn't sufficiently address some edgecases (ex: 323_EPHYS1_OPTO_2024-06-18_tube can be matched instead of 323_EPHYS1_OPTO_20240212). This feature may still be supportable (the query might not be as easy). Since there are still discussions on whether or not rig metadata will be stored in slims, I will update the snippet when we have more clarity.

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 a pull request may close this issue.

2 participants