Skip to content

17 clean service oriondb ingest and map penelopedb sensor data - #44

Merged
diyakadakia merged 29 commits into
mainfrom
17-clean-service-oriondb-ingest-and-map-penelopedb-sensor-data
Oct 15, 2026
Merged

diyakadakia merged 29 commits into
mainfrom
17-clean-service-oriondb-ingest-and-map-penelopedb-sensor-data

Conversation

@shreya-m9

Copy link
Copy Markdown
Collaborator

Overview

Created ingest.py in orion folder and manual_ingest_test.py in the testing folder to test the ingest. Normalized bms soc sensor to 1-100, fixed GPS lag, mapped to clean sensor names, and separated the multivalue sensors into different rows with suffix _0/_1/_2 depending on which value it is.

Technical Description

Queried Penelope DB to get raw data from a run id and timestamp first, then ingest file has helper functions to normalize, map clean sensors, and separate multivalue columns. These are then called in ingest_run function. The sensor_sources and sensors tables are also filled with the signal_catalog mappings.

There is one problem which is that when we suffix the sensors, the suffix ones are not mapped back to a source. However, the base name is mapped back to the source and is also present in sensors. We weren't sure how we wanted to fix this...maybe a base sensor column in the sensor_sources? or changing the signal catalog?

How Has This Been Tested?

Tested with custom tests in manual_ingest_testing.py; they test the full ingest and some reading and rollback functions. All passed meaning that reading penelope, rollback, cleaning, and writing to orion DB works as expected

Screenshot 2026-10-08 at 12 29 55 PM

Ticket Review

Answer the following:

  1. What went well: We worked well together and were able to equally contribute to the ticket
  2. What was difficult: Testing, since we needed secret .env variables and neonDB instances to be set up
  3. If you could start over what would you do differently: Maybe start a little bit earlier so that we had more time to troubleshoot at the end

Diya Kadakia and others added 21 commits October 6, 2026 19:43
…or-data' of https://github.com/GenerateNU/orion into 17-clean-service-oriondb-ingest-and-map-penelopedb-sensor-data
…or-data' of https://github.com/GenerateNU/orion into 17-clean-service-oriondb-ingest-and-map-penelopedb-sensor-data
…, first 4 tests passed, need to test last 2
@shreya-m9 shreya-m9 linked an issue Oct 8, 2026 that may be closed by this pull request
t.c.dataTypeName == data_type_name,
)
with self.engine.connect() as conn:
return conn.execute(stmt).scalar() 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.

What is this method for?

Comment thread backend/penelope/client.py Outdated
return self._fetch(stmt)

def get_all_paginated(self, batch_size: int = 5000):
def get_all_paginated(self, batch_size: int = 5000, stmt=None):

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 variable being stmt is really ambiguous also injecting a SQL query to our get method is questionable. I would much prefer if you pass it a list of sensor names you wish to query then have a helper construct what its pulling.

Comment thread backend/orion/ingest.py Outdated
return written


def ingest_run(

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.

I think I need a code walkthrough on monday. There is a lot going on here

Comment thread backend/orion/schema.py
Column("sensor", String, ForeignKey("sensors.name"), nullable=False)
)

signals_table = Table(

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.

What is the point of the signals table?

Comment thread backend/orion/ingest.py Outdated
tables=[sensors_table, sensor_sources_table, cleaned_data_table],
checkfirst=True,
)
with engine.begin() as conn:

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.

If this is a service, why are there connections to the db? That should happen in a repository. Services should only have business logic

Comment thread backend/orion/ingest.py Outdated
"vcu_eth_a_gyro",
})

def _flag_investigation_tags(run_id: str, sensor_names: set[str]) -> set[str]:

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.

What does this part do? The needs investigation part was supposed to be you guys doing research to see if you believe that they should be included in our algorithm or if you think they are unimportant for what we want.

@dirizhablik dirizhablik 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.

Looks good to me!

@TKDPenguin TKDPenguin 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.

Looks good to me. Thanks for updating it

@diyakadakia
diyakadakia merged commit f407427 into main Oct 15, 2026
2 checks passed
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.

[Clean Service] [OrionDB] Ingest and Map PenelopeDB Sensor Data

5 participants