{"id":25131962,"url":"https://github.com/robotomize/sod","last_synced_at":"2025-04-03T00:11:44.642Z","repository":{"id":64302333,"uuid":"302248234","full_name":"robotomize/sod","owner":"robotomize","description":"Recognition of anomalies in the data stream in real time. Identify peaks. Fraud detection.","archived":false,"fork":false,"pushed_at":"2023-06-07T09:26:09.000Z","size":9177,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-08T14:16:02.431Z","etag":null,"topics":["anomaly-detection","fraud-detection","go","golang","golang-application","lof","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robotomize.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}},"created_at":"2020-10-08T06:13:24.000Z","updated_at":"2023-08-16T11:22:41.000Z","dependencies_parsed_at":"2023-01-15T09:45:28.230Z","dependency_job_id":null,"html_url":"https://github.com/robotomize/sod","commit_stats":null,"previous_names":["go-sod/sod"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fsod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fsod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fsod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fsod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robotomize","download_url":"https://codeload.github.com/robotomize/sod/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246911471,"owners_count":20853657,"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":["anomaly-detection","fraud-detection","go","golang","golang-application","lof","machine-learning"],"created_at":"2025-02-08T14:16:04.415Z","updated_at":"2025-04-03T00:11:44.600Z","avatar_url":"https://github.com/robotomize.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SOD\n\n**Note**: The `master` branch may be in an *unstable or even broken state* during development. Please use [releases][github-release] instead of the `master` branch in order to get stable binaries.\n\n**Note**: The current version is not intended for use in production\n\n## \u003cimg src=\"https://raw.githubusercontent.com/robotomize/sod/main/docs/images/sod-horizontal.svg\" width=\"400\"\u003e\n\nSOD  - simple outlier detection. A simple solution for detecting anomalies in a vector data stream with a focus on being:\n\n* *Simple*: well-defined, user-facing HTTP API\n* *Fast*: benchmarked 1,000 prediction/sec on core, million samples\n* *Storage*: automatically maintains the actual required range of the sample data\n* *Without training*: Uses the k nearest neighbor algorithm to detect anomalies without training data\n\n## Description\n\nSOD is written in Go and consists of several components: a database, an algorithm for detecting anomalies, notifications, and an HTTP interface for access.\nThe data storage system uses etcd/bbolt - a key/value embedded database that saves a set of data to disk.\nAnomaly recognition is based on the LOF - local outlier factor method.\nThis method uses the k nearest neighbor method to detect anomalies.\nTo notify about an anomaly found, SOD sends a POST request with data.\n\n## LOF white paper\n\n![lof image](docs/images/lof.png)\n\n[LOF agorithm white paper](https://www.dbs.ifi.lmu.de/Publikationen/Papers/LOF.pdf)\n\n## Getting started\n\n### Getting SOD\n\nThe simplest method to run is to run the docker image and throw the necessary environment variables.\n\n### Running SOD\n\nSOD uses the configuration method via environment variables. \nRunning SOD from the repository\n\n```\n $ git clone https://github.com/robotomize/sod.git\n $ cd sod\n $ go build cmd/sod\n```\n\nor build docker image\n\n```bash\n $ docker build .\n```\n\nBy default, the application runs on **:8787**. SOD operates in two modes:\n\n### Predict handle\n\nPredict(read only) is getting the value outlier or not outlier without saving the state.\n\nYour request will be mapped to the following structure\n\nPOST request to /predict\n```json\n{\n  \"entity\": \"user-lives\",\n  \"data\": [\n    {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [100], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}\n  ] \n}\n```\n\n```bash\ncurl -X POST -d '{entityId: \"user-lives\", \"data\": [ {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}, {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}, {\"vector\": [10], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}, {\"vector\": [100], \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}]}' http://localhost:8787/predict\n```\n\nresponse\n```json\n{\n  \"entity\": \"user-lives\",\n  \"data\": [\n    {\"vector\": [100], \"outlier\": true, \"extra\": \"robotomize\", \"createdAt\": \"timestamp\"}\n  ] \n}\n```\n\n### Collect handle\n\nCollect(read write) - To save the value in SOD, recognize it, and inform your applications about the outlier, send a POST request to the /collect address\n\nlet's say we collect weather data\n\nPOST request to /collect\n```json\n{\n  \"entity\": \"weather\",\n  \"data\": [\n    {\"vector\": [20, 365, 7], \"extra\": \"20-10-2020\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [21, 364, 2], \"extra\": \"21-10-2020\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [20, 365, 5], \"extra\": \"22-10-2020\", \"createdAt\": \"timestamp\"},\n    {\"vector\": [25, 370, 0], \"extra\": \"22-10-2020\", \"createdAt\": \"timestamp\"}\n  ] \n}\n```\n\nresponse\n```json\n{\"status\":  \"ok\"}\n```\n\n### Health check\n\nyou can check the viability\n\n```bash\ncurl -X GET http://localhost:8787/health\n```\n\nresponse\n```json\n{\"status\":  \"ok\"}  \n```\n\n### TODO\n* Implement tests\n* Add examples\n* request reformat\n* Add docs\n* ci/docker image\n* cli client\n* Another transport gateways\n* Try implement R tree/R*tree\n* Try implement isolation forest alg\n* DB abstraction layer\n* Web ui\n\n### Documentation\n* [Installation](docs/installation.md)\n\n### License\n\nSOD is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotomize%2Fsod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobotomize%2Fsod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotomize%2Fsod/lists"}