11import { Accident , ClusterRow , ModelFilterType , ModelPointWithDensity , ModelSeverityMode , ModelSeverityRange } from "../../types" ;
22
33const JUNCTION_RADIUS_METERS = 50 ;
4-
4+ const JUNCTION_HEB_VAL = "עירונית בצומת (כולל צמתים בגבולות יישובים)" ;
55
66export function clusterPoints ( points : Accident [ ] , junctionRaduis = JUNCTION_RADIUS_METERS ) : Accident [ ] [ ] {
77 const clusters : Accident [ ] [ ] = [ ] ;
@@ -11,14 +11,14 @@ export function clusterPoints(points: Accident[], junctionRaduis = JUNCTION_RADI
1111 const filteredPoints = points . filter (
1212 p =>
1313 ! (
14- p . road_type_hebrew === "עירונית בצומת" &&
14+ p . road_type_hebrew === JUNCTION_HEB_VAL &&
1515 p . location_accuracy_hebrew !== "עיגון מדויק"
1616 )
1717 ) ;
1818 // 1. Extract junctions
1919 const junctions = filteredPoints
2020 . map ( ( p , i ) => ( { p, i } ) )
21- . filter ( x => x . p . road_type_hebrew === "עירונית בצומת" ) ;
21+ . filter ( x => x . p . road_type_hebrew === JUNCTION_HEB_VAL ) ;
2222
2323 // 2. Junction-based clustering
2424 for ( const { p : junction , i : junctionIndex } of junctions ) {
@@ -80,7 +80,7 @@ export function buildClusterTable(
8080 const severityIndex = calcSeverityIndex ( cluster , mode ) ;
8181
8282 const junctionPoint = cluster . find (
83- p => p . road_type_hebrew === "עירונית בצומת"
83+ p => p . road_type_hebrew === JUNCTION_HEB_VAL
8484 ) ;
8585
8686 // ----- Junction cluster -----
@@ -171,9 +171,9 @@ export function buildDensityClustersTable(
171171 const filteredPoints = points . filter ( p => {
172172 if ( filterType === ModelFilterType . All ) return true ;
173173 if ( filterType === ModelFilterType . Junctions )
174- return p . road_type_hebrew === "עירונית בצומת" ;
174+ return p . road_type_hebrew === JUNCTION_HEB_VAL ;
175175 if ( filterType === ModelFilterType . Streets )
176- return p . road_type_hebrew !== "עירונית בצומת" ;
176+ return p . road_type_hebrew !== JUNCTION_HEB_VAL ;
177177 return true ;
178178 } ) ;
179179
@@ -187,10 +187,10 @@ export function buildDensityClustersTable(
187187
188188 // 4️⃣ split
189189 const junctionPoints = topPoints . filter (
190- p => p . road_type_hebrew === "עירונית בצומת"
190+ p => p . road_type_hebrew === JUNCTION_HEB_VAL
191191 ) ;
192192 const streetPoints = topPoints . filter (
193- p => p . road_type_hebrew !== "עירונית בצומת"
193+ p => p . road_type_hebrew !== JUNCTION_HEB_VAL
194194 ) ;
195195
196196 // 5️⃣ map junctions
0 commit comments