{"id":21644718,"url":"https://github.com/iris-hunkeler/gym-class-tracker","last_synced_at":"2026-04-20T04:05:52.229Z","repository":{"id":207904508,"uuid":"625633321","full_name":"iris-hunkeler/gym-class-tracker","owner":"iris-hunkeler","description":"A simple tracker for free spots in a gym class implemented in Python using the AWS Serverless Application Model","archived":false,"fork":false,"pushed_at":"2023-11-18T10:32:03.000Z","size":213,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-14T14:42:46.957Z","etag":null,"topics":["aws","aws-dynamodb","aws-lambda","python","serverless","serverless-application-model"],"latest_commit_sha":null,"homepage":"","language":"Python","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/iris-hunkeler.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}},"created_at":"2023-04-09T18:01:35.000Z","updated_at":"2023-07-21T17:08:19.000Z","dependencies_parsed_at":"2023-11-18T11:37:18.006Z","dependency_job_id":null,"html_url":"https://github.com/iris-hunkeler/gym-class-tracker","commit_stats":null,"previous_names":["iris-hunkeler/gym-class-tracker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iris-hunkeler/gym-class-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-hunkeler%2Fgym-class-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-hunkeler%2Fgym-class-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-hunkeler%2Fgym-class-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-hunkeler%2Fgym-class-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iris-hunkeler","download_url":"https://codeload.github.com/iris-hunkeler/gym-class-tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-hunkeler%2Fgym-class-tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32032306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["aws","aws-dynamodb","aws-lambda","python","serverless","serverless-application-model"],"created_at":"2024-11-25T05:42:05.102Z","updated_at":"2026-04-20T04:05:52.186Z","avatar_url":"https://github.com/iris-hunkeler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gym class tracker\n\nThe gym class tracker is a very simple application that can setup a \"tracker query\" to the REST of a Gym for the availability of a class.\n\n![c4-context-diagram](docs/rendered/c4-context-diagram.png)\n\nThe application is built using a simple serverless setup with *Lambda*, *DynamoDB*, *SNS* and *EventBridge Scheduler*.\n\n![aws-architecture](docs/rendered/aws-architecture.png)\n\nThe \"tracker query\" and its current state are stored in *DynamoDB*. A *Lambda function* contains the logic to call the gym API and check if the class of interest is currently available to be booked. For any status changes or errors, a notification is sent to a (fixed) user using *SNS*. The Lambda Function is called regularly using an *Event Bridge Scheduler* \n\n![sequence-diagram](docs/rendered/sequence-diagram.png)\n\n## Project structure\n\nThis project uses the [AWS Serverless Application Model (SAM)](https://aws.amazon.com/serverless/sam/) and was built using the [AWS Toolkit in VSCode](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html).\n\nFolder structure:\n- `execute-check` - Code for the Lambda function executing a check against the gym's API.\n- `events` - Invocation events that you can use to invoke the function.\n- `tests` - Unit tests for the application code. \n- `template.yaml` - A template that defines all the application's AWS resources.\n- `docs` - Diagrams for documentation\n- `proof-of-concept` - First draft of the Lambda function which was originally manually deployed\n\n## Deploy the sample application\n\nTo build and deploy the application for the first time, run the following in your shell:\n\n```bash\nsam build --use-container\n\n# this will guide you through installation and prompt for the stack name, AWS region and capability to create IAM roles (to create/modifycIAM roles, the `CAPABILITY_IAM` value for `capabilities` must be set). Arguments can be savet to samconfig.toml\nsam deploy --guided\n```\n\nAfter the first deployment, these comments can be used to deploy changes:\n\n```bash\nsam build \nsam deploy --parameter-overrides EmailAddress=[enter email address to send notifications] \n```\n\n## Use the SAM CLI to build and test locally\n\n**Build** your application with the `sam build --use-container` command.\n\n```bash\n# build: installs dependencies and creates a deployment package in .aws-sam/build\nsam build --use-container\n```\n\n**Run functions locally** and invoke them with the `sam local invoke` command. Test events are included in the `events` folder in this project.\n\n```bash\nsam local invoke ExecuteCheckFunction --event events/empty-call.json\n```\n\n## Fetch, tail, and filter Lambda function logs\n\n**Read logfiles** from the deployed Lambda function using the SAM CLI:\n```bash\nsam logs -n ExecuteCheckFunction --stack-name gym-class-tracker --tail\n```\n\n## Create a tracker query\n\nExample for a query in DynamoDB\n```\n{\n  \"partition-key\": {\n    \"S\": \"query-1\"\n  },\n  \"sort-key\": {\n    \"S\": \"1\"\n  },\n  \"entity-name\": {\n    \"S\": \"check-query\"\n  },\n  \"active-status\": {\n    \"S\": \"1\"\n  },\n  \"availability-status\": {\n    \"S\": \"Unknown\"\n  },\n  \"center-id\": {\n    \"S\": \"23\"\n  },\n  \"course-title\": {\n    \"S\": \"BODYPUMP® 55'\"\n  },\n  \"daytime-id\": {\n    \"S\": \"4\"\n  },\n  \"weekday-id\": {\n    \"S\": \"3\"\n  }\n}\n```\n\n### Variables\n\ncenter-id:\n* 23 = Zürich Altstetten\n\ndaytime-id:\n* 1 = morning\n* 2 = noon\n* 3 = afternoon\n* 4 = evening\n\nweekday-id:\n* 1 = Monday\n* ... \n* 7 = Sunday\n\n## Cleanup\n\n**Delete** the deployed application again:\n```bash\nsam delete gym-class-tracker\n```\n\n## Resources\n* [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html): for an introduction to SAM specification, the SAM CLI, and serverless application concepts.\n* [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/): Discover, deploy and publish serverless applications\n\n## Improvement options\n- [ ] Split `app.py` into different files: separate for DynamoDB, API handling and SNS\n- [ ] Add tests for separate areas\n- [ ] build additional Lambda CreateTrackerQuery that writes a tracker-query into DynamoDB\n- [ ] build API Gateway for CreateTrackerQuery\n- [ ] Secure API Gateway\n- [ ] Enable different email addresses (maybe move away from SNS for this?)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firis-hunkeler%2Fgym-class-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firis-hunkeler%2Fgym-class-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firis-hunkeler%2Fgym-class-tracker/lists"}