{"id":32460211,"url":"https://github.com/arundo/foundation-compute-example","last_synced_at":"2026-07-11T13:32:44.258Z","repository":{"id":313907526,"uuid":"1053321966","full_name":"arundo/foundation-compute-example","owner":"arundo","description":"Example of a Foundation plug-and-play Python compute","archived":false,"fork":false,"pushed_at":"2025-09-09T11:34:05.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-11T13:32:39.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arundo.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-09T09:37:17.000Z","updated_at":"2025-09-09T12:17:57.000Z","dependencies_parsed_at":"2025-09-09T14:25:37.177Z","dependency_job_id":"ea3a6c15-e464-41b1-8fb2-99f5835ce39d","html_url":"https://github.com/arundo/foundation-compute-example","commit_stats":null,"previous_names":["arundo/foundation-compute-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arundo/foundation-compute-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arundo%2Ffoundation-compute-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arundo%2Ffoundation-compute-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arundo%2Ffoundation-compute-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arundo%2Ffoundation-compute-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arundo","download_url":"https://codeload.github.com/arundo/foundation-compute-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arundo%2Ffoundation-compute-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35364269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-26T11:23:13.070Z","updated_at":"2026-07-11T13:32:44.253Z","avatar_url":"https://github.com/arundo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# foundation-compute-example\n\nExample of a Python compute compatible with the Foundation platform.\n\n## Documentation\n\n- **[API Schema Documentation](API_SCHEMA.md)** - Specification of request and response schemas\n\n## Installation\n\nThis project uses Poetry for dependency management. Install Poetry if you haven't already:\n\n```bash\npipx install poetry\n```\n\nThen install dependencies:\n\n```bash\npoetry install\n```\n\n## Running the service\n\nStart the service:\n\n```bash\npoetry run python src/main.py\n```\n\nThe service will be available at `http://localhost:8060`\n\n## Example Usage\n\n### 1. Health Check\n\n```bash\ncurl http://localhost:8060/healthz\n# Returns: OK\n```\n\n### 2. Execute Rolling Mean Computation\n\nThe rolling mean computation supports a configurable window size parameter. If not specified, it defaults to 3.\n\n#### Default Window Size (3)\n\n```bash\ncurl -X POST http://localhost:8060/execute/rolling_mean \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"data\": {\n      \"sensor1\": {\n        \"1704110400000\": 10.0,\n        \"1704110460000\": 12.0,\n        \"1704110520000\": 8.0,\n        \"1704110580000\": 15.0,\n        \"1704110640000\": 11.0\n      }\n    },\n    \"parameters\": {},\n    \"tick\": 1704110400,\n    \"uwid\": \"a2c39e3c-30dd-4e53-ad7d-2ec0c0b35729\"\n  }'\n```\n\n**Response:**\n\n```json\n{\n  \"data\": {\n    \"sensor1\": {\n      \"1704110400000\": 10.0,\n      \"1704110460000\": 11.0,\n      \"1704110520000\": 10.0,\n      \"1704110580000\": 11.666666666666666,\n      \"1704110640000\": 11.333333333333334\n    }\n  },\n  \"uwid\": \"a2c39e3c-30dd-4e53-ad7d-2ec0c0b35729\"\n}\n```\n\n#### Custom Window Size (2)\n\n```bash\ncurl -X POST http://localhost:8060/execute/rolling_mean \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"data\": {\n      \"sensor1\": {\n        \"1704110400000\": 10.0,\n        \"1704110460000\": 12.0,\n        \"1704110520000\": 8.0,\n        \"1704110580000\": 15.0,\n        \"1704110640000\": 11.0\n      }\n    },\n    \"parameters\": {\"window_size\": 2},\n    \"tick\": 1704110400,\n    \"uwid\": \"89c4996e-2822-40f3-b9fd-c55685c606f9\"\n  }'\n```\n\n**Response:**\n\n```json\n{\n  \"data\": {\n    \"sensor1\": {\n      \"1704110400000\": 10.0,\n      \"1704110460000\": 11.0,\n      \"1704110520000\": 10.0,\n      \"1704110580000\": 11.5,\n      \"1704110640000\": 13.0\n    }\n  },\n  \"uwid\": \"89c4996e-2822-40f3-b9fd-c55685c606f9\"\n}\n```\n\n#### Custom Window Size (4)\n\n```bash\ncurl -X POST http://localhost:8060/execute/rolling_mean \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"data\": {\n      \"sensor1\": {\n        \"1704110400000\": 10.0,\n        \"1704110460000\": 12.0,\n        \"1704110520000\": 8.0,\n        \"1704110580000\": 15.0,\n        \"1704110640000\": 11.0\n      }\n    },\n    \"parameters\": {\"window_size\": 4},\n    \"tick\": 1704110400,\n    \"uwid\": \"0e52793a-3201-4d02-9f77-776a64ae522b\"\n  }'\n```\n\n**Response:**\n\n```json\n{\n  \"data\": {\n    \"sensor1\": {\n      \"1704110400000\": 10.0,\n      \"1704110460000\": 11.0,\n      \"1704110520000\": 10.0,\n      \"1704110580000\": 11.25,\n      \"1704110640000\": 11.5\n    }\n  },\n  \"uwid\": \"0e52793a-3201-4d02-9f77-776a64ae522b\"\n}\n```\n\n#### 3. Multiple Input Sensors\n\nThe rolling mean computation can process multiple sensor inputs simultaneously:\n\n```bash\ncurl -X POST http://localhost:8060/execute/rolling_mean \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"data\": {\n      \"temperature\": {\n        \"1704110400000\": 22.5,\n        \"1704110460000\": 23.1,\n        \"1704110520000\": 21.8,\n        \"1704110580000\": 24.2,\n        \"1704110640000\": 23.7\n      },\n      \"humidity\": {\n        \"1704110400000\": 65.0,\n        \"1704110460000\": 67.2,\n        \"1704110520000\": 63.8,\n        \"1704110580000\": 69.1,\n        \"1704110640000\": 66.5\n      }\n    },\n    \"parameters\": {\"window_size\": 3},\n    \"tick\": 1704110400,\n    \"uwid\": \"2b38a400-7a63-490a-a414-e4efbe478fb2\"\n  }'\n```\n\n**Response:**\n\n```json\n{\n  \"data\": {\n    \"temperature\": {\n      \"1704110400000\": 22.5,\n      \"1704110460000\": 22.8,\n      \"1704110520000\": 22.466666666666665,\n      \"1704110580000\": 23.033333333333335,\n      \"1704110640000\": 23.233333333333334\n    },\n    \"humidity\": {\n      \"1704110400000\": 65.0,\n      \"1704110460000\": 66.1,\n      \"1704110520000\": 65.33333333333333,\n      \"1704110580000\": 66.7,\n      \"1704110640000\": 66.46666666666665\n    }\n  },\n  \"uwid\": \"2b38a400-7a63-490a-a414-e4efbe478fb2\"\n}\n```\n\n#### 4. Test Invalid Compute Name (Error Handling)\n\n```bash\ncurl -X POST http://localhost:8060/execute/invalid_compute \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"data\": {\n      \"sensor1\": {\n        \"2024-01-01T10:00:00\": 10.0\n      }\n    },\n    \"parameters\": {},\n    \"tick\": 1704110400,\n    \"uwid\": \"test-invalid\"\n  }'\n```\n\n**Expected Error Response:**\n\n```json\n{\n  \"issues\": [\n    {\n      \"code\": \"invalid_compute_name\",\n      \"message\": \"Invalid compute name 'invalid_compute'. Valid options: rolling_mean\",\n      \"path\": [\"compute_name\"]\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farundo%2Ffoundation-compute-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farundo%2Ffoundation-compute-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farundo%2Ffoundation-compute-example/lists"}