{"id":46082450,"url":"https://github.com/dlcs/dlcs-protagonist-recalculators","last_synced_at":"2026-03-01T16:01:44.651Z","repository":{"id":191380989,"uuid":"682161725","full_name":"dlcs/dlcs-protagonist-recalculators","owner":"dlcs","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-17T17:19:23.000Z","size":85,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-11-17T19:17:38.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"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/dlcs.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":"2023-08-23T15:14:54.000Z","updated_at":"2025-11-17T17:18:10.000Z","dependencies_parsed_at":"2023-10-10T20:31:28.968Z","dependency_job_id":"87cdbbcc-0ae6-49d5-a898-e6ba3f68a97d","html_url":"https://github.com/dlcs/dlcs-protagonist-recalculators","commit_stats":null,"previous_names":["dlcs/dlcs-protagonist-recalculators"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dlcs/dlcs-protagonist-recalculators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlcs%2Fdlcs-protagonist-recalculators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlcs%2Fdlcs-protagonist-recalculators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlcs%2Fdlcs-protagonist-recalculators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlcs%2Fdlcs-protagonist-recalculators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlcs","download_url":"https://codeload.github.com/dlcs/dlcs-protagonist-recalculators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlcs%2Fdlcs-protagonist-recalculators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T15:41:30.362Z","status":"ssl_error","status_checked_at":"2026-03-01T15:37:07.343Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-03-01T16:01:44.172Z","updated_at":"2026-03-01T16:01:44.642Z","avatar_url":"https://github.com/dlcs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dlcs-protagonist-recalculators\n\nThis repository contains a set of functions designed to help recalculate tables in the\ndatabase that have gone out of sync.  These are as follows:\n\n## Entity Counter Recalculator\n\nThis resets `customer-images` and `space-images` within the `EntityCounter` table to match details from the `Images`\ntable. This is completed by performing an `UPSERT` on the database.\nIt passes details from these changes into cloudwatch metrics for the following details:\n\n- Difference between `EntityCounter` and `Images` for customer images and space images\n- Deletions required to match the `EntityCounter` table to `Images` for customer images and space images\n\n## Customer Storage Recalculator\n\nResets `CustomerStorage` table by summing `ImageStorage` rows.\n\n## Local development\n\n### Environment variables\n\nThere are several environment variables that need to be set. The list of these variables has an example file at the\nroot of this project called `.env-dist`.  You need to copy and set the variables in this file into a `.env` file.\nThere is also a powershell script to pull these variables into the console called `SetEnvFile.ps1`.  This is required\nto be set before the scripts can be run.\n\n### Prerequisites\n\nPrerequisites for the project can be installed from `pip` using the following command:\n\n```powershell\npip install -r requirements.txt\n```\n\n### Updating requirements\n\nIn order to avoid encoding issues in `requirements.txt` when running a `pip freeze` in powershell requires\nthat the file format be set to `UTF-8`. This can be done with the following command:\n\n```powershell\npip freeze -l | Out-File -Encoding UTF8 requirements.txt\n```\n\n### Running\n\nThe scripts can be run directly with python or via the built docker container\n\n#### Running directly\n\nFirst, the environment variables need to be set, as above.\n\nYou can run directly using the below commands\n\n```powershell\npython \u003cfile location\u003e\n```\n\nAn example of this is below, if running from the root of this project:\n\n```powershell\npython .\\entity-counter-recalculator\\main.py\n```\n\n#### Running via docker\n\nThe docker container can be built with the following commands:\n\n```powershell\n# EntityCounter\ndocker build -f .\\src\\EntityCounterDockerfile -t dlcs-entity-counter-recalculator:local .\\src\n\n# CustomerStorage\ndocker build -f .\\src\\CustomerStorageDockerfile -t dlcs-customer-storage-recalculator:local .\\src\n```\n\nthen run with this command:\n\n```powershell\n# EntityCounter\ndocker run -it --env-file .env dlcs-entity-counter-recalculator:local\n\n# CustomerStorage\ndocker run -it --env-file .env dlcs-customer-storage-recalculator:local\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlcs%2Fdlcs-protagonist-recalculators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlcs%2Fdlcs-protagonist-recalculators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlcs%2Fdlcs-protagonist-recalculators/lists"}