@@ -139,6 +139,12 @@ function processThreatData() {
139139 region = getRandomCountryCode ( ) ;
140140 }
141141
142+ // Skip if the region is not in our countryCenters mapping
143+ if ( ! countryCenters [ region ] ) {
144+ console . warn ( `Unknown region: ${ region } . Skipping this account.` ) ;
145+ return ;
146+ }
147+
142148 // Add to the threats by country
143149 if ( ! threatsByCountry [ region ] ) {
144150 threatsByCountry [ region ] = [ ] ;
@@ -153,7 +159,7 @@ function processThreatData() {
153159 // Create multiple pings for countries with multiple threats
154160 accounts . forEach ( account => {
155161 // Create a slightly randomized location within the country
156- const pingLocation = getRandomLocationNear ( baseLocation . lat , baseLocation . lng , 10 ) ; // Increased radius for better spread
162+ const pingLocation = getRandomLocationNear ( baseLocation . lat , baseLocation . lng , 2 ) ; // Reduced radius to keep pings within the country
157163
158164 // Determine threat level based on account properties
159165 const threatLevel = determineThreatLevel ( account ) ;
@@ -192,7 +198,7 @@ function getCountryLocation(countryCode) {
192198}
193199
194200// Get a random location near the specified coordinates
195- function getRandomLocationNear ( lat , lng , radiusInDegrees = 3 ) {
201+ function getRandomLocationNear ( lat , lng , radiusInDegrees = 2 ) {
196202 const radius = radiusInDegrees * ( Math . random ( ) * 0.8 + 0.2 ) ; // Random radius between 20% and 100% of max
197203 const angle = Math . random ( ) * 2 * Math . PI ; // Random angle
198204
0 commit comments