Dev-crawler into dev - #242
Conversation
…into dev-crawler
, issue .env with .gitignore
I had an issue on the server, where it doesnt want to start, because stac-js is ESM only and the project isnt
…g data extraction and ensuring consistent property ordering
insertOrUpdateCatalog and insertOrUpdateCollection
function to insert keywords
…ensions helper function
…into dev-crawler
…ries, providers, and assets
Crawler: Create Database Connection
feat: enhance crawler configuration with CLI and environment variable…
… just write collections (#245) * feat(api): initialize STAC Atlas API with collections, conformance, and queryables routes - Added package.json for project dependencies and scripts. - Implemented GET endpoint for collections. - Created conformance endpoint to list supported conformance classes. - Developed landing page for the API with links to collections and documentation. - Added queryables endpoint to return queryable properties for collections. (If i'm correct this can be removed) * Added all Remarks to the bid and finished it (#74) * changed Texts 1,2 and 8 according to the remarks of the customer * Did my fixes to 4. and 10.3 * added remark why we want to save every catalog * deleted keywords for catalog * changed everything related to the database component * Updated 3.1, 3.3, 3,4 (References to Lastenheft/small other changes) * Added small Graph to 3. Produktumgebung * Update bid.md 7.3STAC-Validator added the handling of collections that cannot be validated automatically. * Update bid.md 7.3STAC-API-Validator changed the way we validate the collection search extension. * Update bid.md 9.3.2Endpunkte small fix collection search extension. * added Skizze for 3, and updated 6.1, 10.1 * Updated 3. Produktumgebung * Update bid.md 7.Qualitätsanforderungen minor fixes * Update 6.4.2 added remark about loading feedback * Minor change to Table in "11 Zeitplan". A collum was missing in the head, therefore the table wasn't rendering correctly.. --------- Co-authored-by: Jakob <vertrox78@gmail.com> Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de> Co-authored-by: jklaer <jklaer@uni-muenster.de> Co-authored-by: VincentKuehn <vkuehn@uni-muenster.de> Co-authored-by: mammutor <mammutor@gmail.com> Co-authored-by: Humam <44206081+Mammutor@users.noreply.github.com> Co-authored-by: Justin K <justinkrumbhmer@yahoo.com> * fix(api): enhance STAC API landing page and conformance links - Overhaul of first idea landing page - Added some more tests for the required elements in the landingpage-Catalog * feat(api): implement shared conformance URIs and add tests for conformance endpoint - implemented condormance endpoint * Implemented 2.3 and 2.4 (#111) * Temporary mock data for testing and frontend development * Added API middleware layer for error handling and validation * TODOs ready? pls review * Added API utilities for query parsing, validation, and response formatting * Added swagger and openapi.yaml * Update queryables.js Refactor queryables endpoint into /collections/queryables * Renamed the collections.js file to mocks-collections.js to better reflect its purpose and improve project clarity * changed README "Projektstruktur" * restart from dev-api 22.11..2025 * API: 2.3 Implement Collections List Endpoint done (added explanations as comments in the code) * API: 2.4 Implement Single Collection Endpoint (added explanations as comments in the code) * Update api/routes/collections.js Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * Changed some of the code with the comments on Github (i will finish it tomorrow morning) * Implement most of the feedback and comments (need to talk about some other changes) * Update api/routes/index.js Changed wording from `/collections/queryables` to `/collections-queryables` * Update api/README.md Changed wording from `/collections/queryables` to `/collections-queryables` * Update api/README.md Removed missing folder * Update api/routes/collections.js Removed TODOs from wrong lines * Update api/routes/collections.js Added TODOs * Update api/routes/queryables.js Changed wording from `/collections/queryables` to `/collections-queryables` * Update api/routes/queryables.js Changed wording from `/collections/queryables` to `/collections-queryables` --------- Co-authored-by: VincentKuehn <vkuehn@uni-muenster.de> Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * feat(api): add collection search parameters and validation middleware (#159) * feat(api): add collection search parameters and validation middleware * Added unit-test for validator-functions and integration-tests for `GET /collections`-Querys. - Also minor bugfix, because the validator accepted deecimals as tokens. * API: 3 Database Integration first version (#161) * database connection in implementated. The parameters for the connection have to added in the .env-file. Also there is test-file for testing and console messages (installed `pg`) * support for spatial queries via postgis + error handling for datatbase operations changed language to english * error handling * added DATABASE_URL There is an issue with the distance query. Changed the error handling and testing, the console messages are now way better structured * found the Problem with the distance query. The layer are so big, that they reach over the 180° long (PostgGIS can't handel that). Now the calc is done by degree and not meters. * The two files `test-data-retrieval.js` and `verify-schema.js` have been added. `test-data-retrieval` (theoretical, checks against the spezification): ``` Discovers all tables and columns and validates against expected schema. ``` The second files `verify-schema.js` (practical, checks against the real data): ``` Discovers all tables and columns, validates against expected schema ``` * pooling error hanling and log imporoved. renamed tests files to actual test-files * standalone node tests were convertad into JEST * write file `validateRequest.js`. Validates every incoming API request, whether the request is valid and logical. * commented `stac_id` from the tests, it is not in both databases, so the tests for `stac_id` will always fail Added explanation to the `.env.example`, which port is which database * added example pattern for API - database connection. * deleted `validateRequest` cause it's already implemented by @RobinGummels --------- Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de> * Added environment variables and a `.env` for `docker-compose.yml` (#164) * added `.env` * added environment for docker-compose.yml now every connection-details are inside an `.env`. There is an `example.env` for better understanding which need to be set as connection details * added description of how to use the `.env` and `example.env` in the `README.md` * changed a few things e.g. DB_PORT --> ${DB_PORT} * now, everthing should be done. my god, help. sorry * layout issues fixed * Fixed Typo/incomplete Sentence in README.md --------- Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de> Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * Added a CI/CD Pipeline to prevent pull-requests without functioning tests and proper linting. * fixed errors suggested by the linter. - Some lines used tab and spaces... * Implemented Collection Search extension including a DB-Connection (#165) * added SQLQuery-builder with these parameters: q,bbox,datetime,sortby,limit and token * finalised bbox and datetime * adapted to DB, QueryBuilder and added helperfunction runQuery * added question-TODOs * added bbox+datetime to the Query-Builder from Jonas * added tests for Query-Builder from Jonas * added tests from George * added falsely deleted TODOs again * fixed collumn names to match our DB and adjusted full text search to match 05_indexes.sql correctly * Used a formatter and linter on `buildCollectionSearchQuery.js * Did some major and minor fixes to the collection search. - Updated `buildCollectionSearchQuery` to support pagination and improved text search with English language settings. - Modified tests in `buildCollectionsSearchQuery.basic.test.js`, `collections-pagination.test.js`, and `collections-sort.test.js` to reflect new query behavior and validation logic. - Enhanced sort validation in `validators.test.js` and `collectionSearchParams.js` to map API fields to database column names. - Implemented total count retrieval for matched results in `collections.js`. * Added a internal .env creation in the CI/CD Pipeline. It utilzes GitHub Repository Secrets to not publish any private Logins and stuff. * Forgot that the second Job of the CI/CD pipeline runs seperatly and needs a internal .env file too. * Enhance documentation for buildCollectionSearchQuery Updated the documentation for: - the buildCollectionSearchQuery function - the fulltextsearch * Refactor buildCollectionSearchQuery and updated SELECT part Changed the SELECT part to match our bid and the database shema. Updated comments and for clarity. Changed full-text search to use 'simple' configuration instead of 'english'. * Update api/routes/collections.js small typo Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * Remove sorting TODO from collections route Removed TODO comment about sorting based on sortby parameter. * Explicitly return undefined for normalized in validateSortby Update validateSortby function to explicitly return undefined for normalized when sortby is not provided. * small fix in buildCollectionSearch.fulltext.test.js Change plainto_tsquery language from 'english' to 'simple' * Fix duplicate SELECT keyword in query Remove duplicate 'SELECT' keyword in SQL query. * Fix missing newline at end of collectionSearchParams.js * Fixed missing bracket in collectionSearchParams.js * Refactor validateSortby for optional parameter handling Refactor validateSortby function to handle optional sortby parameter and improve validation logic. * Stabilize API test pipeline by running Jest in-band with extended timeout Run Jest in CI with --runInBand and a higher default --testTimeout to stabilize database-backed integration tests. Multiple Jest workers were competing for the same PostgreSQL connection pool and some long-running /collections queries exceeded the default 5s timeout, causing failures in existing test suites (e.g. collectionSearch and DBconnection). * Fixed leaking tests that blocked CI/CD-Pipeline. - Added a global Teardown for jest and force-exited the tests to prevent leaking. - Made a change to db_APIconnection to only log the pool-(dis)connection if it isn't run in a test enviroment. * Did a minimum amount of Formatting to the discription * Used `npm audit fix --force` to fix all vulnerabilties in our used packages. * Fixed curious doublechecking for empty Strings for the sortby-Parameter. - Now we only check once for a empty sortby - And added a test which distinguish between `sortby=""` and `sortby="+"` * Update api/routes/collections.js Removed the TODO about switching from mock-data to the real db * Removed globalTeardown as i brought up some problems corresponding to long db-queries (for example BBOX). Instead i increased the maximal testTimeout. --------- Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * Update api/.env.example * latest database Version (#187) with `stac_id` and changed definition of `primary Keys` * added `.env` * added environment for docker-compose.yml now every connection-details are inside an `.env`. There is an `example.env` for better understanding which need to be set as connection details * added description of how to use the `.env` and `example.env` in the `README.md` * changed a few things e.g. DB_PORT --> ${DB_PORT} * now, everthing should be done. my god, help. sorry * layout issues fixed * Fixed Typo/incomplete Sentence in README.md * added `stac_id` for collections * all IDs are now written in the newer PostgrSQL standart: ```SQL id SERIAL PRIMARY KEY, ``` changed to ```SQL id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY, ``` * changed `extend` to `extent`. * Changed language used in `./api/README.md` from german to english. I wanted to thsi anyway at some point, but this is now more like a Test-commit to see if the CI/CD Pipeline triggers... --------- Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de> Co-authored-by: Robin Tammo Gummels <github@gummels.eu> * bug fix: extent was written wrong * feat: add source URL extraction for catalogs and collections * feat: update insertOrUpdateCatalog to only process catalogs for traversal, no longer saving to database --------- Co-authored-by: RobinGummels <github@gummels.eu> Co-authored-by: Jakob <vertrox78@gmail.com> Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de> Co-authored-by: jklaer <jklaer@uni-muenster.de> Co-authored-by: VincentKuehn <vkuehn@uni-muenster.de> Co-authored-by: mammutor <mammutor@gmail.com> Co-authored-by: Humam <44206081+Mammutor@users.noreply.github.com> Co-authored-by: Justin K <justinkrumbhmer@yahoo.com> Co-authored-by: Georgios Voulgaris <gvoulgar@uni-muenster.de> Co-authored-by: Sönke Hoffmann <hoffmann.sonke@gmx.de>
- Introduced periodic clearing of the `apis` array in `checkAndFlushApi` to free memory, with a defined batch size. - Updated `checkAndFlush` in `handlers.js` to ensure the `catalogs` array is cleared only if it exists, preventing potential errors. - Improved logging for memory management actions to provide better insights during API operations.
…mmary functions - Removed the source_url parameter from the insertOrUpdateCollection function, simplifying the SQL query. - Updated the insertSummary function to include source_url in the database insert statement. - Adjusted related calls to insertSummary to pass the new source_url parameter. - Enhanced the handling of collection summaries to ensure proper data insertion.
RobinGummels
left a comment
There was a problem hiding this comment.
Seems fine, i guess... Maybe change the point with you .env
we have to decide later what exactly to do
Delete .env.example in root
Crawler: Fix DB Insertion and Memory Overflow
|
Classical perfomance-error Problem in CI/CD-Pipeline. Probably because you are running the Crawler again, the responsetime for basic Querys is greater then 5 Seconds.
If you wan't to, i can just force the merge and skip tests. |
…Collection function - Updated the function to support both normalized (bbox) and original STAC format (extent.spatial.bbox) for spatial extent. - Improved temporal extent parsing to accommodate both normalized (temporal) and original STAC format (extent.temporal.interval). - Refactored code for better clarity and maintainability.
- Modified the `create` function calls in `handleApiRoot`, `handleApiCollection`, and `handleCatalog` to set the second parameter to `false`, preventing URL migration. - Added comments to clarify the change and its implications for STAC compliance validation.
…ndlers - Implemented checks in `handleApiRoot` and `handleCatalog` to ensure the JSON response is valid before processing. - Added logging for invalid JSON responses to improve error tracking and handling. - Updated comments to clarify the purpose of disabling URL migration in STAC object creation.
- Updated request handlers in `crawlApis` and `crawlCatalogs` to include a fallback mechanism for manually parsing JSON responses when automatic parsing fails, because some servers like the DLR usese 14 seconds. - Added logging for successful and failed manual parsing attempts to improve debugging and error tracking. - Adjusted comments to clarify the purpose of the new parsing logic.
…and handlers - Implemented conversion of S3 protocol URLs to HTTPS format in `handleApiRoot`, `tryCollectionEndpoints`, and `handleCatalog` functions. - Added logging for successful conversions and warnings for malformed S3 URLs. - Enhanced handling of relative URLs to ensure they are converted to absolute URLs based on the request context. - Improved validation checks for URLs to skip invalid entries with appropriate logging.
…ng npm install - Changed the npm install command to use the --omit=dev flag, ensuring that only production dependencies are installed in the Docker image.
I dont want to just push with no test. This is not a timely matter, so i would suggest that we just wait |
|
The tests are running. But exactly one test fails, which tracks the perfomance of the response-time. So i would say it would be fair to merge. But i'm also fine with not merging yet. |
- Added support for parallel crawling of multiple domains in both API and catalog crawlers. - Introduced new configuration options for parallel domains, max requests per minute per domain, and max concurrency per domain. - Enhanced logging to provide detailed statistics on parallel crawling performance and domain distribution. - Refactored existing crawling functions to accommodate the new parallel execution model, improving overall efficiency and throughput. - Updated CLI arguments and configuration to support the new parallel crawling features.
- Improved the `normalizeCollection` function to utilize raw data from stac-js objects for more robust metadata extraction. - Added fallback mechanisms for bounding box, temporal extent, self URL, and other properties to ensure reliable data retrieval from both stac-js methods and raw data. - Updated the handling of collection properties to prioritize raw data when available, enhancing overall data integrity.
…al fields for database insertion - Updated the `normalizeCollection` function to extract and preserve additional fields such as links, summaries, and extensions from collection objects. - Ensured compatibility with both stac-js and raw data formats for comprehensive metadata extraction. - Improved overall data integrity by including all necessary fields for database insertion.
… and catalog crawlers - Updated the maxConcurrencyPerDomain setting from 10 to 20 to enhance performance and avoid bottlenecks during crawling. - Adjusted logging to provide detailed information on the number of APIs and catalogs being crawled, including concurrency and rate limits. - Modified rate limiting calculations to ensure minimal delay between requests, allowing for better handling of slow responses.
- Introduced configurable concurrency settings to enhance crawling performance, allowing for immediate scaling and minimal delays between requests. - Updated logging to reflect the new concurrency model and removed unnecessary delay parameters for improved throughput. - Adjusted rate limiting calculations to rely solely on maxRequestsPerMinute, ensuring maximum efficiency during crawling operations.
… crawlers - Simplified concurrency configuration by removing autoscaling options and unnecessary delay parameters, focusing on high throughput. - Updated comments for clarity on rate limiting and concurrency settings, ensuring better understanding of the crawling process. - Maintained additional MIME type support for diverse content handling during crawls.
- Updated the spatial extent string format from EPSG:4326 to SRID=4326 to comply with EWKT requirements. - Ensured proper handling of bounding box coordinates for polygon creation in the database insertion process.
…lection updates - Implemented a deadlock detection mechanism to identify PostgreSQL deadlock errors during collection insertion or update. - Introduced a retry logic with exponential backoff for handling deadlocks, allowing for more robust database operations. - Enhanced the internal collection insertion function to support improved querying by stac_id and source_url, ensuring better handling of collections with the same title from different sources. - Updated error logging to differentiate between deadlock errors and other types of errors during database operations.
… RAM servers - Reduced batch sizes for saving collections and clearing arrays to 25 to accommodate servers with limited RAM (2GB). - Updated API and catalog handling to create STAC objects with memory efficiency in mind, minimizing stored data. - Enhanced garbage collection by dereferencing large objects after processing to improve memory usage. - stac migrate true
Crawler: Hotfix and enhancement to prevent errors for writing in db
This is the newest state of the crawler, but there are still issues with the writing into the DB