Conversation
n_observations fields to road_data tablen_observations field to road_data table
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #423 +/- ##
==========================================
- Coverage 87.78% 87.77% -0.01%
==========================================
Files 52 52
Lines 6319 6323 +4
Branches 701 701
==========================================
+ Hits 5547 5550 +3
- Misses 753 754 +1
Partials 19 19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| bool is_valid = false; | ||
|
|
||
| Measurement(T mean, T std) : mean{mean}, std{std}, is_valid{true} {} | ||
| Measurement() = default; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 16.3 rule Note
| mean = x_mean / data.size(); | ||
| std = std::sqrt(x2_mean / data.size() - mean * mean); | ||
| mean = x_mean / n; | ||
| std = std::sqrt(x2_mean / n - mean * mean); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
| CHECK(roadColumns.count("density_vpk") == 1); | ||
| CHECK(roadColumns.count("avg_speed_kph") == 1); | ||
| CHECK(roadColumns.count("std_speed_kph") == 1); | ||
| CHECK(roadColumns.count("n_observations") == 1); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note test
| CHECK(roadColumns.count("std_speed_kph") == 1); | ||
| CHECK(roadColumns.count("n_observations") == 1); | ||
| CHECK(roadColumns.count("counts") == 1); | ||
| CHECK(roadColumns.count("queue_length") == 1); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note test
There was a problem hiding this comment.
Pull request overview
This PR adds an n_observations field to the road_data SQLite table and the Measurement struct, allowing consumers of the simulation data to know how many speed observations were used to compute the average and standard deviation values for each street at each time step. The Measurement struct is also refactored: the old two-argument constructor is replaced with a three-argument version that includes sample count, and a default constructor is added for invalid/empty measurements.
Changes:
- Extended
Measurement<T>with ann(sample count) field and changed the constructor from(T, T)to(T, T, std::size_t), adding a default constructor for empty/invalid measurements. - Added
n_observationscolumn to theroad_dataSQLite table schema, INSERT statement, andStreetDataRecordstruct; shifted bind parameter indices accordingly. - Updated tests to verify the new
n_observationsandqueue_lengthcolumns exist in the schema.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/dsf/utility/Measurement.hpp |
Added n field, default constructor, changed 2-arg constructor to 3-arg, used n for mean/std computation. |
src/dsf/mobility/RoadDynamics.hpp |
Added n_observations to SQL schema and INSERT, added nObservations to StreetDataRecord, updated bind indices, removed unused variable, changed empty-case returns to default-constructed Measurement. |
test/mobility/Test_dynamics.cpp |
Added schema checks for n_observations and queue_length columns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Requiered by @filippodll