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

DM-48169: Add new components_json field to the jira_fields table. #28

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sebastian-aranda
Copy link
Collaborator

No description provided.

Copy link

@pothiers pothiers left a comment

Choose a reason for hiding this comment

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

I didn't see where tests for "find messages" were. I'd like to see how the tests for the json component is done (so that I can see how the API for searching pieces will be done). But maybe there is NO search enabled for the component_json? But if that's the case then there would be no substitute for the stuff it replaces when deprecation happens.

@@ -60,8 +60,14 @@ def create_message_table(metadata: sa.MetaData) -> sa.Table:
sa.Column("date_invalidated", saty.DateTime(), nullable=True),
sa.Column("parent_id", UUID(as_uuid=True), nullable=True),
# Added 2022-07-19
# 'systems' field is deprecated and will be removed in v1.0.0.

Choose a reason for hiding this comment

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

I don't know any foolproof way to do deprecation for an API unless the API is always accessed via a paired client. Pairing client and API would be important if there were lots of non-Rubin users using the API. I assume that is NOT the case (if my assumption is wrong, maybe we should talk about what I've done in NOIRLab). But, it would be good to add an API endpiont that gives a semantic version. API documentation could warn that when the major component of the version increments, there have backwards incompatible changes. That would at least let API user know when an API change put their (API using) code in a dangerous place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it 👍 I'll work on adding a /version endpoint.

default_factory=dict,
title="JSON representation of systems and subsystems on the OBS jira project. "
"For a full list of valid keys please refer to: "
"https://rubinobs.atlassian.net/wiki/spaces/LSSTCOM/pages/53741849"

Choose a reason for hiding this comment

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

When I look at the documented linked to for "full list of valid keys", I don't see what those keys are. When I search that document for "key", the only two matches are "Keysight". I'm expecting to see something that clearly describes a dictionary (possibly with and example of the full dictionary).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it 👍, I'll iterate over this too to make it more specific.

"**This field is deprecated and will be removed in v1.0.0**. "
"Please use 'components_json' instead.",
),
components_json: None

Choose a reason for hiding this comment

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

Maybe the API documentation is in another place. If this documentation that will show on swagger, there should be more detail here. Its not clear to me if you are allowing for search against the parts of this JSONB file. If you are allowing search against parts, it will take a special kind of search which means special kind of description for how to do it. When I've done something similar, I was able to make searches against the keys in the jsonb field to look like searches in the schema columns. To do so, I confined the jsonb field to one level (keys within in are like column names in the schema, and the values associated with they keys are column values. ) I did that because end users (anyone in the world) might access the API. There are more restrictions on your narrativelog API. Or maybe you are handling it somewhere else and I just haven't gotten to that part yet.

Comment on lines 213 to 225
components_path: None
| str = fastapi.Query(
default=None,
description="Components structure in JSON format."
"All messages with a 'components_json' field that "
"matches the specified structure are included."
"The structure represents the hierarchy of "
"systems and subsystems on the OBS jira project. "
"Current structure: `{'systems': ['system1', ..., 'systemN'], "
"'subsystems': ['subsystem1', ..., 'subsystemN'], "
"'components': ['component1', ..., 'componentN']}`. "
"E.g. `{'systems': ['AuxTel'], 'subsystems': ['ATCamera']}` will match"
" all messages that have 'AuxTel' as system and 'ATCamera' as subsystem.",

Choose a reason for hiding this comment

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

Ah, THIS is was I was expecting to see earlier.
But its not clear to me what the parameter value would look like for "component_path" search. Will the pieces be combined with AND? With OR? (I don't know where the implementation is for that kind of stuff with fastAPI. Hoping it uses ORM to combine instead of SQL.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! I was expecting the example to implicitly indicate how the search will work, i.e. all messages that have 'AuxTel' as system and 'ATCamera' as subsystem. meaning that we are combining key-values over AND. I'll iterate over this to provide something more similar to what we have before with "include any of" and "exclude any of" 👌.

Copy link

@pothiers pothiers left a comment

Choose a reason for hiding this comment

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

Approving based upon anticipated tweaks discussed with Sebastian via slack. Mainly: will add "version/" endpoint and will add description to https://usdf-rsp-dev.slac.stanford.edu/narrativelog/docs#/default/find_messages_messages_get to explain how to do query using the new component_json field.

@sebastian-aranda sebastian-aranda force-pushed the tickets/DM-48169 branch 9 times, most recently from 0e538e1 to 36ad769 Compare December 26, 2024 15:05
Also add deprecation advice and code comments for systems, subsystems, cscs, components, primary_software_components and primary_hardware_components.
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