{"id":25856598,"url":"https://github.com/defra/ai-sdlc-codereview-api","last_synced_at":"2026-02-16T00:32:56.046Z","repository":{"id":278035003,"uuid":"934310321","full_name":"DEFRA/ai-sdlc-codereview-api","owner":"DEFRA","description":"Git repository for service ai-sdlc-codereview-api","archived":false,"fork":false,"pushed_at":"2025-03-10T13:53:41.000Z","size":392,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-12T18:00:25.873Z","etag":null,"topics":["backend","cdp","node","service"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEFRA.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,"zenodo":null}},"created_at":"2025-02-17T16:06:30.000Z","updated_at":"2025-02-25T14:00:14.000Z","dependencies_parsed_at":"2025-02-17T17:25:43.029Z","dependency_job_id":"69b444dc-e9d4-4893-9f63-d281be9ab2f3","html_url":"https://github.com/DEFRA/ai-sdlc-codereview-api","commit_stats":null,"previous_names":["defra/ai-sdlc-codereview-api"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/DEFRA/ai-sdlc-codereview-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fai-sdlc-codereview-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fai-sdlc-codereview-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fai-sdlc-codereview-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fai-sdlc-codereview-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/ai-sdlc-codereview-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fai-sdlc-codereview-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29495008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T00:16:34.147Z","status":"ssl_error","status_checked_at":"2026-02-16T00:15:26.759Z","response_time":118,"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":["backend","cdp","node","service"],"created_at":"2025-03-01T18:19:10.153Z","updated_at":"2026-02-16T00:32:56.029Z","avatar_url":"https://github.com/DEFRA.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ai-sdlc-codereview-api\n\nA Python FastAPI service that provides endpoints for creating and retrieving AI-powered code reviews, with asynchronous analysis using Anthropic's API.\n\n- [ai-sdlc-codereview-api](#ai-sdlc-codereview-api)\n  - [Requirements](#requirements)\n    - [Python](#python)\n    - [Docker](#docker)\n  - [Local development](#local-development)\n    - [Setup \u0026 Configuration](#setup--configuration)\n    - [Development](#development)\n    - [Testing](#testing)\n    - [Production Mode](#production-mode)\n  - [API endpoints](#api-endpoints)\n  - [Custom Cloudwatch Metrics](#custom-cloudwatch-metrics)\n  - [Pipelines](#pipelines)\n    - [Dependabot](#dependabot)\n    - [SonarCloud](#sonarcloud)\n  - [Licence](#licence)\n    - [About the licence](#about-the-licence)\n\n## Requirements\n\n### Python\n\nPlease install python `\u003e= 3.12` and [configure your python virtual environment](https://fastapi.tiangolo.com/virtual-environments/#create-a-virtual-environment):\n\n```python\n# create the virtual environment\npython -m venv .venv\n\n# activate the the virtual environment in the command line\nsource .venv/bin/activate\n\n# update pip\npython -m pip install --upgrade pip \n\n# install the dependencies\npip install -r requirements-dev.txt\n```\n\nThis service uses the [`Fast API`](https://fastapi.tiangolo.com/) Python API framework with MongoDB for data storage and Anthropic's Claude for AI-powered code analysis.\n\nThis and all other runtime python libraries must reside in `requirements.txt`\n\nOther non-runtime dependencies used for dev \u0026 test must reside in `requirements-dev.txt`\n\n### Docker\n\nThis repository uses Docker throughput its lifecycle i.e. both for local development and the environments. A benefit of this is that environment variables \u0026 secrets are managed consistently throughout the lifecycle\n\nSee the `Dockerfile` and `compose.yml` for details\n\n## Local development\n\n### Setup \u0026 Configuration\n\nFollow the convention below for local environment variables and secrets in local development. Note that it does not use .env or python-dotenv as this is not the convention in the CDP environment.\n\n**Environment variables:** `compose/aws.env`.\n\n**Secrets:** `compose/secrets.env`. You need to create this, as it's excluded from version control. Required secrets include:\n- `ANTHROPIC_API_KEY`: If using standard Anthropic, not bedrock\n- `MONGO_URI`: MongoDB connection string (if different from default)\n\n**Libraries:** Ensure the python virtual environment is configured and libraries are installed using `requirements-dev.txt`, [as above](#python)\n\n### Development\n\nThe app can be run locally using Docker compose.  This template contains a local environment with:\n\n- Localstack\n- MongoDB\n- This service\n  \nTo run the application in development mode:\n\n```bash\ndocker compose watch\n```\n\n### Testing\n\nEnsure the python virtual environment is configured and libraries are installed using `requirements-dev.txt`, [as above](#python)\n\nTesting follows the [FastApi documented approach](https://fastapi.tiangolo.com/tutorial/testing/); using pytest \u0026 starlette.\n\nTo test the application run:\n\n```bash\npytest\n```\n\n### Production Mode\n\nTo mimic the application running in `production mode locally run:\n\n```bash\ndocker compose up --build -d\n```\n\nStop the application with\n\n```bash\ndocker compose down\n```\n\n## API endpoints\n\n| Endpoint                    | Description                    |\n| :------------------------- | :----------------------------- |\n| `GET: /docs`               | Automatic API Swagger docs     |\n| `GET: /health`             | Health check endpoint          |\n| `GET: /api/v1/code-reviews` | List all code reviews         |\n| `POST: /api/v1/code-reviews` | Create new code review       |\n| `GET: /api/v1/code-reviews/{id}` | Get specific review      |\n| `GET: /api/v1/code-reviews/{id}/results`| Get review results |\n\n## Custom Cloudwatch Metrics\n\nUses the [aws embedded metrics library](https://github.com/awslabs/aws-embedded-metrics-python). An example can be found in `metrics.py`\n\nIn order to make this library work in the environments, the environment variable `AWS_EMF_ENVIRONMENT=local` is set in the app config. This tells the library to use the local cloudwatch agent that has been configured in CDP, and uses the environment variables set up in CDP `AWS_EMF_AGENT_ENDPOINT`, `AWS_EMF_LOG_GROUP_NAME`, `AWS_EMF_LOG_STREAM_NAME`, `AWS_EMF_NAMESPACE`, `AWS_EMF_SERVICE_NAME`\n\n## Pipelines\n\n### Dependabot\n\nWe have added an example dependabot configuration file to the repository. You can enable it by renaming\nthe [.github/example.dependabot.yml](.github/example.dependabot.yml) to `.github/dependabot.yml`\n\n### SonarCloud\n\nInstructions for setting up SonarCloud can be found in [sonar-project.properties](./sonar-project.properties)\n\n## Licence\n\nTHIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:\n\n\u003chttp://www.nationalarchives.gov.uk/doc/open-government-licence/version/3\u003e\n\nThe following attribution statement MUST be cited in your products and applications when using this information.\n\n\u003e Contains public sector information licensed under the Open Government license v3\n\n### About the licence\n\nThe Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable\ninformation providers in the public sector to license the use and re-use of their information under a common open\nlicence.\n\nIt is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fai-sdlc-codereview-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fai-sdlc-codereview-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fai-sdlc-codereview-api/lists"}