Skip to content

Feat/data models estimation services - #31

Open
shreya-m9 wants to merge 3 commits into
mainfrom
feat/data-models-estimation-services
Open

shreya-m9 wants to merge 3 commits into
mainfrom
feat/data-models-estimation-services

Conversation

@shreya-m9

Copy link
Copy Markdown
Collaborator

Overview

Added pydantic validation models for data ingestion to the models folder and processing services schemas into the services folder. All files in those folders were added/edited.

Technical Description

We achieved the ticket's asks of defining data models through pydantically validated schemas that:

  1. list expected columns for each row in our database (vehicle state model), the raw and cleaned sensor data (sensor model), and metrics calculated for a time window (metrics model)
  2. outline the services needed for each model

How Has This Been Tested?

Created tests for each model, in their own files within tests folder. Mainly tests whether a variety of inputs can be handled in the models since no logic has been implemented in the services
Screenshot 2026-09-19 at 5 55 13 PM

Ticket Review

Answer the following:

  1. What went well
  • Collaboration was great, we discussed every step of the project. We went over our code multiple and peer reviewed each other.
  1. What was difficult
  • Understanding what the services/models needed to entail
  1. If you could start over what would you do differently
  • Maybe we could have spread out this ticket's work over a couple of days

Comment thread backend/models/vehicle.py

TODO: replace `matrix` with named fields (var_lat, var_lon, etc., or the full state-covariance equivalent) once that decision is made.
"""
matrix: list[list[float]] = Field(default_factory=list)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We gotta use numpy for matrix operations otherwise shit gonna get wicked

Comment thread backend/models/sensor.py
timestamp: datetime
value: SensorValue
# measurement noise estimate; feeds the UKF's R matrix..one of the factors that tells UKF whether to trust the sensor or prediction more
stddev: Optional[float] = None No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The stddev should probably exist as a mapping instead of copying the value to every data point. If we have ~100 different sensors and like ~10million sensor readings then we are storing a lot of duplicate values.

@henrybednarz henrybednarz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The services and models all look good. Here are my other thoughts which I also had for other peoples tickets:

I think for non-end events it does not make sense to use pydantic models. This is on me for not thinking hard at the beginning. What is happening there is a ton of memory/computation overhead to use python lists for this type of data (especially with matrix operations). So we need to shift to using numpy arrays/pandas. I think we should discuss as a group at the next meeting to decide how we should move forward. The good news is all the work is basically the same just changing it from pydantic to a numpy/pandas df. Good work though the models all look great.

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.

[State Service] [Clean Service] [Metric Service] Define data models create ingest services interfaces.

3 participants