@@ -64,7 +64,6 @@ export async function loadCsvGzFile(url) {
6464 try {
6565 // Make sure URL starts with correct path
6666 const fullUrl = url . startsWith ( '/' ) ? url : `/${ url } ` ;
67- console . log ( `Fetching from: ${ fullUrl } ` ) ;
6867
6968 // Fetch the gzipped CSV file
7069 const response = await fetch ( fullUrl ) ;
@@ -76,7 +75,6 @@ export async function loadCsvGzFile(url) {
7675 // Parse CSV directly from response text
7776 const csvText = await response . text ( ) ;
7877 const rows = parseCsv ( csvText ) ;
79- console . log ( `Loaded data from ${ fullUrl } with ${ rows . length } rows` ) ;
8078
8179 return rows ;
8280 } catch ( error ) {
@@ -100,15 +98,8 @@ function parseCsv(csvText) {
10098 }
10199
102100 const lines = csvText . trim ( ) . split ( '\n' ) ;
103- console . log ( `CSV has ${ lines . length } lines. First line: ${ lines [ 0 ] } ` ) ;
104101
105102 const headers = lines [ 0 ] . split ( '\t' ) . map ( h => h . trim ( ) ) ;
106- console . log ( `Found headers: ${ headers . join ( ', ' ) } ` ) ;
107-
108- if ( lines . length === 1 ) {
109- console . warn ( "CSV only has a header line, no data" ) ;
110- return [ ] ;
111- }
112103
113104 // Pre-allocate array for better performance
114105 const rows = new Array ( lines . length - 1 ) ;
@@ -128,12 +119,6 @@ function parseCsv(csvText) {
128119 rows [ i - 1 ] = row ;
129120 }
130121
131- const endTime = performance . now ( ) ;
132- console . log ( `Successfully parsed ${ rows . length } rows from CSV in ${ ( endTime - startTime ) . toFixed ( 2 ) } ms` ) ;
133- if ( rows . length > 0 ) {
134- console . log ( `Sample row: ${ JSON . stringify ( rows [ 0 ] ) } ` ) ;
135- }
136-
137122 return rows ;
138123 } catch ( error ) {
139124 console . error ( "Error parsing CSV:" , error ) ;
@@ -153,7 +138,6 @@ export async function addDataFromUrl(url) {
153138 // Add the new rows to the collection
154139 geoCollection . insert ( newRows ) ;
155140
156- console . log ( `Updated geodata collection now has ${ geoCollection . count ( ) } rows` ) ;
157141 return newRows ;
158142}
159143
@@ -165,7 +149,6 @@ export async function addDataFromUrl(url) {
165149export async function getGeoEntriesInBounds ( { minLat, maxLat, minLon, maxLon} ) {
166150 // Handle possible null/undefined bounds
167151 const geohashes_1 = ngeohash . bboxes ( minLat , minLon , maxLat , maxLon , 1 ) ;
168- console . log ( { geohashes_1} )
169152
170153 if ( ! Array . isArray ( geohashes_1 ) || geohashes_1 . length === 0 ) {
171154 console . warn ( "No geohashes found for the current bounds" ) ;
@@ -200,7 +183,6 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
200183 // Download and ingest any new geohash files that haven't been processed yet
201184 // Use consistent path format without leading dot or slash
202185 const needDownload = geohashes_1 . filter ( g => ! ingestedFiles . includes ( `_geodata/${ g } .csv.gz` ) ) ;
203- console . log ( { needDownload} )
204186
205187 if ( needDownload . length > 0 ) {
206188 // needDownload all rows first before doing a single bulk insert
@@ -225,10 +207,7 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
225207
226208 // Do a single bulk insert with all rows
227209 if ( allRows . length > 0 ) {
228- console . time ( 'bulk_insert' ) ;
229210 geoCollection . insert ( allRows ) ;
230- console . timeEnd ( 'bulk_insert' ) ;
231- console . log ( 'Collection size:' , geoCollection . count ( ) ) ;
232211 }
233212 }
234213
0 commit comments