@@ -4,9 +4,10 @@ Shared foundation for all metrics (statistics, simulation metrics, etc.) in Open
44
55## Overview
66
7- ` spp_metrics_core ` provides the base model and categorization system that eliminates duplication of genuinely shared
8- fields across different metric types. All domain modules (statistics, simulations, dashboards) inherit from the base
9- model and add their own computation-specific fields.
7+ ` spp_metrics_core ` provides the base model and categorization system that eliminates
8+ duplication of genuinely shared fields across different metric types. All domain modules
9+ (statistics, simulations, dashboards) inherit from the base model and add their own
10+ computation-specific fields.
1011
1112## Architecture
1213
@@ -24,8 +25,8 @@ spp.metric.base (AbstractModel)
2425
2526Abstract model providing genuinely shared fields for all metric types.
2627
27- Concrete models define their own computation-specific fields (metric_type, format, expressions, etc.) since these vary
28- incompatibly between metric types.
28+ Concrete models define their own computation-specific fields (metric_type, format,
29+ expressions, etc.) since these vary incompatibly between metric types.
2930
3031** Identity**
3132
@@ -72,8 +73,8 @@ Shared categorization for all metric types:
7273
7374## Defining Metrics
7475
75- Since ` spp.metric.base ` is an ** AbstractModel** , it does not store data directly. Domain modules define concrete metrics
76- by inheriting from the base:
76+ Since ` spp.metric.base ` is an ** AbstractModel** , it does not store data directly. Domain
77+ modules define concrete metrics by inheriting from the base:
7778
7879- ` spp_statistic ` - Defines published statistics
7980- ` spp_simulation ` - Defines simulation metrics
@@ -113,9 +114,9 @@ Reference categories in your metrics:
113114
114115``` xml
115116<record id =" my_custom_metric" model =" custom.metric" >
116- <field name =" name" >my_metric</field >
117- <field name =" label" >My Custom Metric</field >
118- <field name =" category_id" ref =" spp_metrics_core.category_population" />
117+ <field name =" name" >my_metric</field >
118+ <field name =" label" >My Custom Metric</field >
119+ <field name =" category_id" ref =" spp_metrics_core.category_population" />
119120</record >
120121```
121122
@@ -125,19 +126,19 @@ Add domain-specific categories:
125126
126127``` xml
127128<record id =" category_health" model =" spp.metric.category" >
128- <field name =" name" >Health</field >
129- <field name =" code" >health</field >
130- <field name =" description" >Health-related metrics</field >
131- <field name =" sequence" >50</field >
129+ <field name =" name" >Health</field >
130+ <field name =" code" >health</field >
131+ <field name =" description" >Health-related metrics</field >
132+ <field name =" sequence" >50</field >
132133</record >
133134```
134135
135136## Migration
136137
137138### From spp_statistic.category
138139
139- The migration automatically renames ` spp.statistic.category ` to ` spp.metric.category ` while preserving all data and
140- external references.
140+ The migration automatically renames ` spp.statistic.category ` to ` spp.metric.category `
141+ while preserving all data and external references.
141142
142143** Before** :
143144
@@ -156,7 +157,8 @@ See [Migration Guide](../../docs/migration/statistics-refactoring.md) for detail
156157## Benefits
157158
1581591 . ** No Duplication** : Genuinely shared fields defined once, reused everywhere
159- 2 . ** Model-Specific Freedom** : Each concrete model defines its own computation fields without conflicts
160+ 2 . ** Model-Specific Freedom** : Each concrete model defines its own computation fields
161+ without conflicts
1601623 . ** Consistent UI** : Common fields (name, label, category) display the same way
1611634 . ** Shared Categories** : One categorization system for all metrics
1621645 . ** Future-Proof** : New metric types easily add their own computation approaches
@@ -174,7 +176,8 @@ See [Migration Guide](../../docs/migration/statistics-refactoring.md) for detail
174176
175177## Architecture Documentation
176178
177- See [ Statistics System Architecture] ( ../../docs/architecture/statistics-systems.md ) for the complete system design.
179+ See [ Statistics System Architecture] ( ../../docs/architecture/statistics-systems.md ) for
180+ the complete system design.
178181
179182## License
180183
0 commit comments