Skip to content

Add nominal capacity to cell - #1930

Draft
be-smith wants to merge 30 commits into
ml-evs/bump-pydantic-final-finalfrom
bes/nominal_cell_capacity_pydanticv2
Draft

Add nominal capacity to cell#1930
be-smith wants to merge 30 commits into
ml-evs/bump-pydantic-final-finalfrom
bes/nominal_cell_capacity_pydanticv2

Conversation

@be-smith

Copy link
Copy Markdown
Member

Adds theoretical/nominal capacity fields to Cell

Adds a theoretical_capacity field (mAh/g) to the Cell model. Combined with the existing characteristic_mass (active mass), it's used to compute nominal_capacity, shown and editable in its own unit (mAh/Ah) in the UI, and updates live as you type — no save round-trip needed.

The computed value is always normalized and additionally stored in nominal_capacity_mah, so plugins/API consumers can read a unit-independent value without having to handle nominal_capacity_unit conversions themselves.

nominal_capacity/nominal_capacity_mah are derived, not user-settable — they're recomputed server-side from theoretical_capacity * characteristic_mass on every save, so the stored value can't drift from the inputs.

Test plan

  • test_cell_nominal_capacity covers: missing inputs, unit conversion (mAh vs Ah), that a client-supplied nominal_capacity is ignored/overwritten, and round-tripping through save/load.Adds a theoretical capacity field that is used combined with active mass to calculate the nominal capacity of the cell.

Stored in nominal_capacity_mah for use with plugins or the API

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.07%. Comparing base (6d809c7) to head (014be2e).

Additional details and impacted files
@@                         Coverage Diff                          @@
##           ml-evs/bump-pydantic-final-final    #1930      +/-   ##
====================================================================
+ Coverage                             80.02%   80.07%   +0.04%     
====================================================================
  Files                                    83       83              
  Lines                                  7626     7644      +18     
====================================================================
+ Hits                                   6103     6121      +18     
  Misses                                 1523     1523              
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/models/cells.py 95.50% <100.00%> (+1.13%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ml-evs
ml-evs changed the base branch from main to ml-evs/bump-pydantic-final-final August 9, 2026 13:08
BenjaminCharmes and others added 28 commits August 9, 2026 14:10
Move back to descriptions in field docstrings and configure this with customised BaseModel

More model updates for pydantic v2
Fixes for routes

Chatblock patch; set default values in block

More updates for blocks
More updates for models

Fixes for models

Simplify item versioning model

Remove unecessary by_alias=True
Pydantic v2's model_json_schema() uses "$defs" instead of "definitions"
(Pydantic v1). Update the four item-information components to use the
correct key so possibleItemStatuses is no longer undefined.
@ml-evs
ml-evs force-pushed the ml-evs/bump-pydantic-final-final branch from 0969519 to 6d809c7 Compare August 9, 2026 13:10
@ml-evs
ml-evs force-pushed the bes/nominal_cell_capacity_pydanticv2 branch from 5b2b1a9 to 014be2e Compare August 9, 2026 19:07
@cypress

cypress Bot commented Aug 9, 2026

Copy link
Copy Markdown

datalab    Run #5277

Run Properties:  status check passed Passed #5277  •  git commit 977cc5fea4 ℹ️: Merge 014be2e002b73c60ef8c4984392e30cf2b334f21 into 6d809c7a5ee5f9ee2347a86ea8d0...
Project datalab
Branch Review bes/nominal_cell_capacity_pydanticv2
Run status status check passed Passed #5277
Run duration 22m 04s
Commit git commit 977cc5fea4 ℹ️: Merge 014be2e002b73c60ef8c4984392e30cf2b334f21 into 6d809c7a5ee5f9ee2347a86ea8d0...
Committer Ben Smith
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 548
View all changes introduced in this branch ↗︎

@ml-evs
ml-evs force-pushed the ml-evs/bump-pydantic-final-final branch 2 times, most recently from f112cf0 to 765d3b1 Compare August 13, 2026 23:12
@ml-evs
ml-evs force-pushed the ml-evs/bump-pydantic-final-final branch 2 times, most recently from 623e1da to c075b7a Compare August 20, 2026 16:17
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.

4 participants