{"id":23257006,"url":"https://github.com/solvro/backend-topwr-sks","last_synced_at":"2026-03-09T19:14:47.351Z","repository":{"id":259802134,"uuid":"879364191","full_name":"Solvro/backend-topwr-sks","owner":"Solvro","description":"SKS Menu Scraper is a tool designed to automatically fetch and parse information about canteen menus, such as dish names, portion sizes, and prices. The project saves the scraped data into a database and provides a RESTful API for users to access menu items","archived":false,"fork":false,"pushed_at":"2024-12-17T10:56:16.000Z","size":503,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T11:19:46.899Z","etag":null,"topics":["charts","csv","food","menu","pwr","sks","solvro","student","students","wust"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Solvro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T17:56:07.000Z","updated_at":"2024-12-17T10:55:34.000Z","dependencies_parsed_at":"2024-10-28T04:12:17.893Z","dependency_job_id":"5af8e18e-38f1-49d1-8f54-5fb41e2e5438","html_url":"https://github.com/Solvro/backend-topwr-sks","commit_stats":null,"previous_names":["solvro/backend-topwr-sks"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solvro%2Fbackend-topwr-sks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solvro%2Fbackend-topwr-sks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solvro%2Fbackend-topwr-sks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solvro%2Fbackend-topwr-sks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Solvro","download_url":"https://codeload.github.com/Solvro/backend-topwr-sks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230432939,"owners_count":18224995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["charts","csv","food","menu","pwr","sks","solvro","student","students","wust"],"created_at":"2024-12-19T12:26:37.048Z","updated_at":"2026-03-09T19:14:47.346Z","avatar_url":"https://github.com/Solvro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SKS Menu Scrapper\n\n![Solvro banner](./assets/solvro_dark.png#gh-dark-mode-only)\n![Solvro banner](./assets/solvro_light.png#gh-light-mode-only)\n\n## Description\n\nSKS Menu Scraper is a tool designed to automatically fetch and parse information about canteen menus, such as dish\nnames, portion sizes, and prices. The project saves the scraped data into a database and provides a RESTful API for\nusers to access menu items.\n\nThe SKS Menu Scraper also includes a feature that acts as a wrapper for external API to handle and track the number of\ncanteen users - [source](https://live.pwr.edu.pl/sks/).\n\n## Endpoints\n\nThe API is available at `sks-api.topwr.solvro.pl`. The following endpoints are available at the moment:\n\n- **GET** `/api/v1/meals`\n  - **Description**: Retrieves list of last scraped menus.\n  - **Request**:\n    ```bash\n    curl -X GET https://sks-api.topwr.solvro.pl/api/v1/meals\n    ```\n  - **Params**:\n    - page (default: 1) - the page number of records to retrieve.\n    - limit (default: 10) - the number of records to return per page.\n  - **Response**:\n    ```json\n    [\n      {\n        \"hash\": \"75e5434015551ef3d22214a4438d1961f9f57e7c0d2a460917bfd4c8dd8b7dda\",\n        \"createdAt\": \"2024-11-15T12:10:00.545+00:00\",\n        \"updatedAt\": \"2024-11-15T12:10:00.545+00:00\",\n        \"meals\": []\n      }\n    ]\n    ```\n- **GET** `/api/v1/meals/current`\n  - **Description**: Retrieves a list of all current or saved menu items (indicated by isMenuOnline field), including\n    dish names, sizes, and prices.\n  - **Request**:\n    ```bash\n    curl -X GET https://sks-api.topwr.solvro.pl/api/v1/meals/current\n    ```\n  - **Response**:\n    ```json\n    {\n      \"meals\": [\n        {\n          \"id\": 85,\n          \"name\": \"Napój z soku jabłkowo-wiśniowego\",\n          \"category\": \"DRINK\",\n          \"size\": \"200ml\",\n          \"price\": \"2.50\",\n          \"createdAt\": \"2024-11-08T11:53:38.644+00:00\",\n          \"updatedAt\": \"2024-11-08T11:53:38.644+00:00\"\n        },\n        {\n          \"id\": 84,\n          \"name\": \"Ziemniaki z koperkiem\",\n          \"category\": \"SIDE_DISH\",\n          \"size\": \"250g\",\n          \"price\": \"4.50\",\n          \"createdAt\": \"2024-11-08T11:53:38.644+00:00\",\n          \"updatedAt\": \"2024-11-08T11:53:38.644+00:00\"\n        },\n        {\n          \"id\": 82,\n          \"name\": \"Pałki drobiowe w ciescie crazy\",\n          \"category\": \"MEAT_DISH\",\n          \"size\": \"250g\",\n          \"price\": \"15.00\",\n          \"createdAt\": \"2024-11-08T11:53:38.642+00:00\",\n          \"updatedAt\": \"2024-11-08T11:53:38.642+00:00\"\n        }\n      ],\n      \"isMenuOnline\": true\n    }\n    ```\n- **GET** `/api/v1/sks-users/current`\n  - **Description**: Retrieves the latest SKS user data with additional info about trend, whether the data is recent or\n    not, and timestamp for the next scheduled update.\n  - **Request**:\n    ```bash\n    curl -X GET https://sks-api.topwr.solvro.pl/api/v1/sks-users/current\n    ```\n  - **Response**:\n    ```json\n    {\n      \"activeUsers\": 1,\n      \"movingAverage21\": 49,\n      \"externalTimestamp\": \"2024-11-11T13:40:00.000+00:00\",\n      \"createdAt\": \"2024-11-10T23:00:00.116+00:00\",\n      \"updatedAt\": \"2024-11-11T13:42:01.017+00:00\",\n      \"trend\": \"STABLE\",\n      \"isResultRecent\": true,\n      \"nextUpdateTimestamp\": \"2024-11-11T13:47:31.017+00:00\"\n    }\n    ```\n- **GET** `/api/v1/sks-users/today`\n  - **Description**: Retrieves the today's data about SKS users count\n  - **Request**:\n    ```bash\n    curl -X GET https://sks-api.topwr.solvro.pl/api/v1/sks-users/today\n    ```\n  - **Response**:\n    ```json\n    [\n      {\n        \"activeUsers\": 1,\n        \"movingAverage21\": 49,\n        \"externalTimestamp\": \"2024-11-11T13:40:00.000+00:00\",\n        \"createdAt\": \"2024-11-10T23:00:00.116+00:00\",\n        \"updatedAt\": \"2024-11-11T13:42:01.017+00:00\"\n      },\n      \"{...}\"\n    ]\n    ```\n\n## Development\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/Solvro/backend-topwr-sks.git\n   cd backend-topwr-sks\n   ```\n\n2. Install the required dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Set up the PostgreSQL database:\n   - Ensure PostgreSQL is installed and running.\n   - Create a new database.\n   - Update the `.env` file with your PostgreSQL credentials and database name.\n\n4. Set up the environment variables in the `.env` file using the `.env.example` template.\n\n5. Run migrations to create the database schema:\n\n   ```bash\n   node ace migration:run\n   ```\n\n6. Run scheduler for scrapper:\n\n   ```bash\n    node ace scheduler:run\n    # or\n    node ace scheduler:work\n   ```\n\n   Alternatively run scraping script once and individually:\n\n   ```bash\n   node ace scrape:menu\n   node ace scrape:users\n   ```\n\n7. Start the development server:\n\n   ```bash\n   npm run dev\n   ```\n\n8. Access the data using:\n\n   ```bash\n   curl -X GET http://localhost:3333/api/v1/meals\n   ```\n\n## Technologies\n\n- Node.js\n- Adonis.js\n- PostgreSQL\n- Coolify\n\n## Database Schema\n\n![schema](./assets/schema3.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolvro%2Fbackend-topwr-sks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolvro%2Fbackend-topwr-sks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolvro%2Fbackend-topwr-sks/lists"}