Skip to content

Add RPM field to data model#8

Merged
LaurensVR3 merged 8 commits into
LaurensVR3:mainfrom
jorlandobr:main
Jul 13, 2026
Merged

Add RPM field to data model#8
LaurensVR3 merged 8 commits into
LaurensVR3:mainfrom
jorlandobr:main

Conversation

@jorlandobr

Copy link
Copy Markdown
Contributor

data_model.py now returns RPM value

I made that change to use a modified racebox template, adding the RPM field for a custom-made device that outputs data in the same fashion that racebox uses,

data_model.py now returns RPM value
@LaurensVR3

Copy link
Copy Markdown
Owner

Good catch on the gap — rpm and exhaust_temp were already added as generic fields on DataPoint (they're populated for AIM and MoTeC already), just never wired up for the RaceBox loader. So this isn't adding a source-specific field, it's finishing something already started, and it's the right file to touch.

The logic itself works, but it calls row.get() three times and the leftover comments/dead line make it hard to follow. Suggested cleanup:

raw_rpm = row.get('Rpm', row.get('rpm'))
rpm = float(raw_rpm) if raw_rpm not in (None, '', 'None') else 0.0,

Same behavior (falls back to 0.0 on missing/empty/None), fewer dict lookups, and drops the commented-out dead line + duplicate 'FIX:' comments. Happy to take this once it's cleaned up.

Cleaner code for rpm verification. Pass the tests
@jorlandobr

Copy link
Copy Markdown
Contributor Author

Using raw_rpm failed the tests. I tried this way, and it works:

           # FIX: Only convert to float if raw_rpm is not None/empty string, else default to 0.0
            rpm        = float(row.get('Rpm', row.get('rpm', 0.0)) or 0.0),

Dead lines removed.

Covers the missing-column default (0.0), Rpm/rpm casing, and empty
string, plus tidies a leftover comment from an earlier revision that
referenced a raw_rpm variable no longer present in the code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@LaurensVR3 LaurensVR3 merged commit 15d8f1c into LaurensVR3:main Jul 13, 2026
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