Skip to content

Commit 80ca27f

Browse files
gracefullightclaude
andcommitted
fix(tems-trp-parser): correct field ID mappings from TRP declarations.cdf
- Remove RF_FIELD_IDS and SIGNED_FIELD_IDS (field IDs vary across sessions) - Field resolution now 100% dynamic from declarations.cdf + SIGNED_KEYWORDS - Remap ALL_FIELD_IDS with corrected IDs from actual TRP analysis (412 fields) - Add VARIABLE_FIELDS for 11 session-dependent field IDs - Update FIELD_MAP to use declarations.cdf field names - Add REF_SIGNAL_POWER and pathloss/referencesignalpower signed keywords Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1f0ee31 commit 80ca27f

5 files changed

Lines changed: 300 additions & 244 deletions

File tree

packages/tems-trp-parser/src/__tests__/aggregate.test.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ describe("aggregateCsv", () => {
3636

3737
it("should group by timestamp", () => {
3838
const csvFile = makeSparseCsv(tmpDir, [
39-
{ timestamp_raw: "100", "LTE.ServingCell.Rsrp": "-95.0" },
40-
{ timestamp_raw: "100", "LTE.ServingCell.RsSinr": "14.0" },
41-
{ timestamp_raw: "101", "LTE.ServingCell.Rsrp": "-100.0" },
42-
{ timestamp_raw: "101", "LTE.ServingCell.Rsrq": "-9.0" },
39+
{ timestamp_raw: "100", "Radio.Lte.ServingCell[8].Rsrp": "-95.0" },
40+
{ timestamp_raw: "100", "Radio.Lte.ServingCell[8].RsSinr": "14.0" },
41+
{ timestamp_raw: "101", "Radio.Lte.ServingCell[8].Rsrp": "-100.0" },
42+
{ timestamp_raw: "101", "Radio.Lte.ServingCell[8].Rsrq": "-9.0" },
4343
]);
4444
const result = aggregateCsv(csvFile);
4545

@@ -56,14 +56,14 @@ describe("aggregateCsv", () => {
5656
const csvFile = makeSparseCsv(tmpDir, [
5757
{
5858
timestamp_raw: "100",
59-
"LTE.ServingCell.Rsrp": "-95.0",
60-
"LTE.ServingCell.Rsrq": "-9.0",
61-
"LTE.ServingCell.Rssi": "-74.0",
62-
"LTE.ServingCell.RsSinr": "14.0",
63-
"LTE.ServingCell.Pci": "253",
64-
"LTE.ServingCell.DL.Earfcn": "3350",
65-
"Common.DL.Throughput": "500.0",
66-
"Common.UL.Throughput": "100.0",
59+
"Radio.Lte.ServingCell[8].Rsrp": "-95.0",
60+
"Radio.Lte.ServingCell[8].Rsrq": "-9.0",
61+
"Radio.Lte.ServingCell[8].Rssi": "-74.0",
62+
"Radio.Lte.ServingCell[8].RsSinr": "14.0",
63+
"Radio.Lte.ServingCell[8].Pci": "253",
64+
"Radio.Lte.ServingCell[8].Downlink.Earfcn": "3350",
65+
"Pocket.Radio.Common.Downlink.Throughput": "500.0",
66+
"Pocket.Radio.Common.Uplink.Throughput": "100.0",
6767
"Location.Latitude": "-34.035",
6868
"Location.Longitude": "151.085",
6969
"Location.Altitude": "73.7",
@@ -90,8 +90,8 @@ describe("aggregateCsv", () => {
9090
const csvFile = makeSparseCsv(tmpDir, [
9191
{
9292
timestamp_raw: "100",
93-
"MRDC.Cell.Rsrp": "-103.0",
94-
"MRDC.Cell.Sinr": "12.0",
93+
"Radio.Common.Mrdc.Cell[64].Rsrp": "-103.0",
94+
"Radio.Common.Mrdc.Cell[64].Sinr": "12.0",
9595
},
9696
]);
9797
const result = aggregateCsv(csvFile, undefined, { minFields: 1 });
@@ -103,7 +103,7 @@ describe("aggregateCsv", () => {
103103

104104
it("should filter by min_fields", () => {
105105
const csvFile = makeSparseCsv(tmpDir, [
106-
{ timestamp_raw: "100", "LTE.ServingCell.Rsrp": "-95.0" },
106+
{ timestamp_raw: "100", "Radio.Lte.ServingCell[8].Rsrp": "-95.0" },
107107
{ timestamp_raw: "101" },
108108
]);
109109

@@ -118,8 +118,8 @@ describe("aggregateCsv", () => {
118118
const csvFile = makeSparseCsv(tmpDir, [
119119
{
120120
timestamp_raw: "100",
121-
"LTE.ServingCell.Rsrp": "-95.0",
122-
"LTE.ServingCell.RsSinr": "14.0",
121+
"Radio.Lte.ServingCell[8].Rsrp": "-95.0",
122+
"Radio.Lte.ServingCell[8].RsSinr": "14.0",
123123
},
124124
]);
125125
const output = join(tmpDir, "output.csv");
@@ -137,7 +137,7 @@ describe("aggregateCsv", () => {
137137

138138
it("should handle empty input", () => {
139139
const csvFile = join(tmpDir, "empty.csv");
140-
writeFileSync(csvFile, "timestamp_raw,LTE.ServingCell.Rsrp\n");
140+
writeFileSync(csvFile, "timestamp_raw,Radio.Lte.ServingCell[8].Rsrp\n");
141141
const result = aggregateCsv(csvFile);
142142
expect(result).toEqual([]);
143143
});
@@ -156,10 +156,13 @@ describe("aggregateToRfCsv", () => {
156156

157157
it("should write with extra fields", () => {
158158
const csvFile = join(tmpDir, "sparse.csv");
159-
writeFileSync(csvFile, "timestamp_raw,LTE.ServingCell.Rsrp,Wifi.Cell.Rssi\n100,-95.0,-87\n");
159+
writeFileSync(
160+
csvFile,
161+
"timestamp_raw,Radio.Lte.ServingCell[8].Rsrp,Radio.Wifi.Cell[64].Rssi\n100,-95.0,-87\n",
162+
);
160163
const output = join(tmpDir, "rf.csv");
161164
const result = aggregateToRfCsv(csvFile, output, {
162-
extraFields: { WIFI_RSSI: ["Wifi.Cell.Rssi"] },
165+
extraFields: { WIFI_RSSI: ["Radio.Wifi.Cell[64].Rssi"] },
163166
});
164167

165168
expect(result).toBe(output);

packages/tems-trp-parser/src/aggregate.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,42 @@ import { dirname } from "node:path";
1515

1616
// Priority order: first match wins per output column
1717
export const FIELD_MAP: Record<string, string[]> = {
18-
RSSI: ["LTE.ServingCell.Rssi", "Common.Rssi", "LTE.ServingCell.Rx.Rssi"],
19-
RSRP: ["LTE.ServingCell.Rsrp", "LTE.ServingCell.Rx.Rsrp", "MRDC.Cell.Rsrp"],
20-
RSRQ: ["LTE.ServingCell.Rsrq", "LTE.ServingCell.Rx.Rsrq", "MRDC.Cell.Rsrq"],
21-
SNR: ["LTE.ServingCell.RsSinr", "LTE.ServingCell.Rx.Cinr", "MRDC.Cell.Sinr"],
22-
PCI: ["LTE.ServingCell.Pci", "MRDC.Cell.Pci"],
23-
EARFCN: ["LTE.ServingCell.DL.Earfcn", "LTE.CellStats.Earfcn", "MRDC.Cell.Channel"],
24-
BAND: ["Radio.Lte.ServingCell[8].Band", "MRDC.Cell.Band", "LTE.ServingCell.Band"],
18+
RSSI: [
19+
"Radio.Lte.ServingCell[8].Rssi",
20+
"Pocket.Radio.Common.Rssi",
21+
"Radio.Lte.ServingCell[8].RxAntenna[4].Rssi",
22+
],
23+
RSRP: [
24+
"Radio.Lte.ServingCell[8].Rsrp",
25+
"Radio.Lte.ServingCell[8].RxAntenna[4].Rsrp",
26+
"Radio.Common.Mrdc.Cell[64].Rsrp",
27+
],
28+
RSRQ: [
29+
"Radio.Lte.ServingCell[8].Rsrq",
30+
"Radio.Lte.ServingCell[8].RxAntenna[4].Rsrq",
31+
"Radio.Common.Mrdc.Cell[64].Rsrq",
32+
],
33+
SNR: [
34+
"Radio.Lte.ServingCell[8].RsSinr",
35+
"Radio.Lte.ServingCell[8].RxAntenna[4].Cinr",
36+
"Radio.Common.Mrdc.Cell[64].Sinr",
37+
],
38+
PCI: ["Radio.Lte.ServingCell[8].Pci", "Radio.Common.Mrdc.Cell[64].Pci"],
39+
EARFCN: [
40+
"Radio.Lte.ServingCell[8].Downlink.Earfcn",
41+
"Radio.Lte.CellStatistics[20].Earfcn",
42+
"Radio.Common.Mrdc.Cell[64].Channel",
43+
],
44+
BAND: ["Radio.Lte.ServingCell[8].Band", "Radio.Common.Mrdc.Cell[64].Band"],
2545
CQI: [
2646
"Radio.Lte.ServingCell[8].CqiRank1Codeword0",
2747
"Radio.Lte.ServingCell[8].CqiCodeword0Average",
2848
"Radio.Lte.ServingCell[8].Stream[2].Cqi",
2949
],
30-
UL: ["Common.UL.Throughput", "Common.UL.LowLevelThroughput"],
31-
DL: ["Common.DL.Throughput", "Common.DL.LowLevelThroughput"],
50+
UL: ["Pocket.Radio.Common.Uplink.Throughput", "Radio.Common.Uplink.LowLevelThroughput"],
51+
DL: ["Pocket.Radio.Common.Downlink.Throughput", "Radio.Common.Downlink.LowLevelThroughput"],
3252
PATHLOSS: ["Radio.Lte.ServingCell[8].Downlink.Pathloss"],
53+
REF_SIGNAL_POWER: ["Radio.Lte.ServingCellTotal.ReferenceSignalPower"],
3354
RANK: ["Radio.Lte.ServingCell[8].RankIndication"],
3455
LAT: ["Location.Latitude"],
3556
LON: ["Location.Longitude"],
@@ -50,6 +71,7 @@ export const OUTPUT_COLUMNS = [
5071
"UL",
5172
"DL",
5273
"PATHLOSS",
74+
"REF_SIGNAL_POWER",
5375
"RANK",
5476
"LAT",
5577
"LON",

0 commit comments

Comments
 (0)