{"id":15196975,"url":"https://github.com/ofirelarat/recommendations-api","last_synced_at":"2026-01-06T08:09:41.914Z","repository":{"id":249396089,"uuid":"831404414","full_name":"ofirelarat/recommendations-api","owner":"ofirelarat","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-03T15:15:03.000Z","size":12075,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T05:35:12.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ofirelarat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-20T13:01:26.000Z","updated_at":"2024-08-03T15:15:07.000Z","dependencies_parsed_at":"2024-07-20T14:23:59.894Z","dependency_job_id":"5e46da35-9658-4093-b6a5-6edcb348ea96","html_url":"https://github.com/ofirelarat/recommendations-api","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"bba034a94f7bcb4ae01163506cc129eddadb061b"},"previous_names":["ofirelarat/recommendations-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofirelarat%2Frecommendations-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofirelarat%2Frecommendations-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofirelarat%2Frecommendations-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofirelarat%2Frecommendations-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ofirelarat","download_url":"https://codeload.github.com/ofirelarat/recommendations-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245798359,"owners_count":20673902,"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":[],"created_at":"2024-09-28T00:22:06.263Z","updated_at":"2026-01-06T08:09:36.887Z","avatar_url":"https://github.com/ofirelarat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recommendations Clustering Service with In-Memory and Redis Data Models\n\n## Overview\n\nThis project provides a clustering service for managing objects and their associated values, leveraging both in-memory and Redis data models. It includes functionalities for adding objects, computing recommendations, and finding common values. The project also integrates linting with TSLint, testing with Jest, and continuous integration with GitHub Actions.\n\n## Features\n\n- Add objects and their associated values.\n- Compute and update recommendations for values.\n- Find the most common values associated with a target value or an object.\n- In-memory and Redis-based data models.\n- Continuous integration with GitHub Actions.\n- Linting with TSLint.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Table of Contents](#table-of-contents)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Testing](#testing)\n- [Linting](#linting)\n- [Continuous Integration](#continuous-integration)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Setup\n\n### Prerequisites\n\n- Node.js (version 16.x or 18.x recommended)\n- Redis (optional, for Redis data model)\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/ofirelarat/recommendations-api.git\n   cd clustering-service\n2. Install dependencies:\n   ```bash\n   npm install\n3. Set up Redis (optional, if using Redis data model):\n  - Install Redis locally or run it using Docker:\n     ```bash\n     docker run --name redis -p 6379:6379 -d redis:alpine\n\n## Usage\n### In-Memory Data Model\nExample of using the clustering service with the in-memory data model:\n\n```typescript\nimport { InMemoryDataModel } from './repositories/InMemoryDataModel';\nimport { ClusteringService } from './ClusteringService';\n\nconst dataModel = new InMemoryDataModel();\nconst clusteringService = new ClusteringService(dataModel);\n\n// Add objects\nawait clusteringService.addObject({ id: '1', values: ['a', 'b', 'c'] });\nawait clusteringService.addObject({ id: '2', values: ['b', 'd'] });\n\n// Add range of values\nawait clusteringService.addRange('1', ['d', 'e']);\n\n// Find common values\nconst commonValues = await clusteringService.findMostCommonValues('a', 2);\nconsole.log(commonValues);  // Output: ['b', 'c']\n```\n\n### Redis Data Model\nExample of using the clustering service with the Redis data model:\n\n```typescript\nimport Redis from 'ioredis';\nimport { RedisDataModel } from './repositories/RedisDataModel';\nimport { ClusteringService } from './ClusteringService';\n\nconst redisClient = new Redis();\nconst dataModel = new RedisDataModel(redisClient);\nconst clusteringService = new ClusteringService(dataModel);\n\n// Add objects\nawait clusteringService.addObject({ id: '1', values: ['a', 'b', 'c'] });\nawait clusteringService.addObject({ id: '2', values: ['b', 'd'] });\n\n// Add range of values\nawait clusteringService.addRange('1', ['d', 'e']);\n\n// Find common values\nconst commonValues = await clusteringService.findMostCommonValues('a', 2);\nconsole.log(commonValues);  // Output: ['b', 'c']\n\n// Disconnect Redis\nredisClient.disconnect();\n\n```\n\n## Testing\n\n### Sample App\n#### Running the Sample App with Docker Compose\n\n1. Ensure Docker and Docker Compose are installed on your machine.\n2. Navigate to `./sample/` dir\n3. Run the following command to build and start the services:\n```bash\ndocker-compose up --build\n```\nThis command will build the Docker images for both the frontend and backend, start the services, and set up the necessary dependencies.\n\nAccessing the Sample App\nBackend API: The backend API will be accessible at http://localhost:5000.\nFrontend Application: The frontend application will be accessible at http://localhost:3000.\n\nIf you would link to test changes in the src code using the sample app use `npm link` to create local version of the lib and run the backend manually with the new version using build \u0026 start commands\n\n### Running Tests\nTo run the tests, use the following command:\n\n```bash\nnpm test\n```\n\n### GitHub Actions\nThis project uses GitHub Actions for continuous integration. The workflow is defined in .github/workflows/test.yml.\n`.github/workflows/test.yml`.\n\n## Linting\n### Running TSLint\nTo run TSLint, use the following command:\n\n```bash\nnpm run lint\n```\n\n### TSLint Configuration\n\nTSLint is configured in `tslint.json`. You can customize the linting rules according to your project's requirements.\n\n## Continuous Integration\n### GitHub Actions Workflow\nThe GitHub Actions workflow is set up to run on pull requests to the main branch. It includes steps for linting, building, and testing the project.\n\n### Workflow File\nThe workflow file is located at .github/workflows/test.yml.\n\n\n## Contributing\nWe welcome contributions to this project. To contribute:\n\n1. Fork the repository.\n2. Create a new branch.\n3. Make your changes.\n4. Submit a pull request.\n\nPlease ensure your code adheres to the project's coding standards and passes all tests.\n\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofirelarat%2Frecommendations-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofirelarat%2Frecommendations-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofirelarat%2Frecommendations-api/lists"}