Support for additional NR metrics
[ric-app/mc.git] / mc-core / mc / queries / addreq_stats.gsql
index 8e0cf03..081eaf6 100644 (file)
@@ -7,20 +7,19 @@ PARAM{ window uint;}
 //     to convert rsrp to dbm, subtract 157
 
 select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
-       physCellId as CELL_ID,
+       physCellId as CELL_ID, gnb_id as GNB_ID,
        count(*) as cnt,
        INT(min(rsrp))-INT(157) as min_rsrp,
        INT(quantile_of(rsrp, .05)) - INT(157) as pctl_05_rsrp,
        INT(median_of(rsrp)) - INT(157) as median_rsrp,
        INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
        sqrt(
-               sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
-               sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
+               sum( (rsrp-157.0)*(rsrp-157.0) )  -
+               sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
        ) / count(*) as stddev_rsrp,
        INT(max(rsrp))-INT(157) as max_rsrp
 from SGNB_ADDITION_REQ.sgnb_addreq_for_ue_mn_neigh_ssb
-//where schemaId = 410
-group by timestamp_ms/$window as tb, physCellId
+group by timestamp_ms/$window as tb, physCellId, gnb_id
 ;
 
 DEFINE{ query_name 'addreq_stats_nr_gnb'; 
@@ -39,10 +38,9 @@ select ($window*(tb+1))/1000 as TS, $window/1000.0 as measurementInterval,
        INT(median_of(rsrp)) - INT(157) as median_rsrp,
        INT(quantile_of(rsrp, .95)) - INT(157) as pctl_95_rsrp,
        sqrt(
-               sum( (FLOAT(rsrp)-157)*(FLOAT(rsrp)-157))  -
-               sum( (FLOAT(rsrp)-157) )*sum( (FLOAT(rsrp)-157) )/count(*)
+               sum( (rsrp-157.0)*(rsrp-157.0) )  -
+               sum( rsrp-157.0 )*sum( rsrp-157.0 )/count(*)
        ) / count(*) as stddev_rsrp,
        INT(max(rsrp))-INT(157) as max_rsrp
 from SGNB_ADDITION_REQ.sgnb_addreq_for_ue_mn_neigh_ssb
-//where schemaId = 410
 group by timestamp_ms/$window as tb, gnb_id