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

Modalities serializer unable to serialize models made from jsons #1117

Closed
mekhlakapoor opened this issue Oct 21, 2024 · 1 comment
Closed
Assignees

Comments

@mekhlakapoor
Copy link
Contributor

mekhlakapoor commented Oct 21, 2024

Describe the bug
The metadata-service rig endpoint is broken for older rig JSONS because the serialize_modalities function does not handle when the modality is a dict object (from older models).

To Reproduce
Steps to reproduce the behavior:

  1. Go to http://aind-metadata-service-dev/rig/323_EPHYS1_OPTO_20240212
  2. Open locally to see error

Expected behavior
Have the serializer be able to handle different types. Create a unit test that replicates the behavior

Screenshots
File "/app/src/aind_metadata_service/response_handler.py", line 160, in map_to_json_response
response = self._map_data_response(validate=validate)
File "/app/src/aind_metadata_service/response_handler.py", line 104, in _map_data_response
json.loads(aind_model.model_dump_json())
File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 415, in model_dump_json
return self.pydantic_serializer.to_json(
pydantic_core._pydantic_core.PydanticSerializationError: Error serializing to JSON: PydanticSerializationError: Error calling function serialize_modalities: AttributeError: 'dict' object has no attribute 'name'

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@mekhlakapoor mekhlakapoor changed the title Modalities serializer in Rig cannot handle older schema versions Modalities serializer in Rig breaks for older versions Oct 21, 2024
@mekhlakapoor mekhlakapoor self-assigned this Oct 21, 2024
@mekhlakapoor mekhlakapoor changed the title Modalities serializer in Rig breaks for older versions Modalities serializer unable to serialize models made from jsons Oct 21, 2024
This was referenced Oct 22, 2024
@mekhlakapoor
Copy link
Contributor Author

closed by #1120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant