Skip to content

Commit 427f07a

Browse files
committed
fix: use quantileExactOrNull so empty population prior stays NULL (IN-1249)
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent b2d214a commit 427f07a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

services/libs/tinybird/pipes/health_score_v2.pipe

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DESCRIPTION >
1818
without security data averaged 85.0 vs 80.8 for measured peers, and 2,742 repos were rated
1919
"excellent" with zero security assessment. Imputing at the population median instead removes
2020
that reward: missing weight earns the typical rate, not the repo's inflated rate. Population
21-
medians are computed from the same *_ds tables via population_priors NODE (quantileExact(0.5)
21+
medians are computed from the same *_ds tables via population_priors NODE (quantileExactOrNull(0.5)
2222
over measured-only rows). Each category datasource already carries NULL when its own coverage
2323
fell below 40% (Layer 1, done per-category pipe). If fewer than 2 of the 3 categories are
2424
available, healthScoreV2 becomes NULL — a single-category score cannot anchor a reliable median
@@ -37,23 +37,23 @@ SQL >
3737
SELECT
3838
coalesce(
3939
(
40-
SELECT quantileExact(0.5)(maintainerHealthScoreV2 / 40.0)
40+
SELECT quantileExactOrNull(0.5)(maintainerHealthScoreV2 / 40.0)
4141
FROM health_score_v2_maintainer_ds
4242
WHERE maintainerHealthScoreV2 IS NOT NULL
4343
),
4444
0.0
4545
) AS priorMaintainerRate,
4646
coalesce(
4747
(
48-
SELECT quantileExact(0.5)(securitySupplyChainScoreV2 / 35.0)
48+
SELECT quantileExactOrNull(0.5)(securitySupplyChainScoreV2 / 35.0)
4949
FROM health_score_v2_security_ds
5050
WHERE securitySupplyChainScoreV2 IS NOT NULL
5151
),
5252
0.0
5353
) AS priorSecurityRate,
5454
coalesce(
5555
(
56-
SELECT quantileExact(0.5)(developmentActivityScoreV2 / 25.0)
56+
SELECT quantileExactOrNull(0.5)(developmentActivityScoreV2 / 25.0)
5757
FROM health_score_v2_development_ds
5858
WHERE developmentActivityScoreV2 IS NOT NULL
5959
),

0 commit comments

Comments
 (0)