{"id":18238197,"url":"https://github.com/defra/pha-import-notifications","last_synced_at":"2026-05-02T06:37:52.408Z","repository":{"id":260085562,"uuid":"880230032","full_name":"DEFRA/pha-import-notifications","owner":"DEFRA","description":"Git repository for service pha-import-notifications","archived":false,"fork":false,"pushed_at":"2025-03-26T10:08:42.000Z","size":1334,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-26T11:24:18.106Z","etag":null,"topics":["backend","cdp","dotnet","service"],"latest_commit_sha":null,"homepage":null,"language":"C#","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":"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}},"created_at":"2024-10-29T11:04:22.000Z","updated_at":"2025-03-26T10:06:50.000Z","dependencies_parsed_at":"2024-11-18T16:29:39.298Z","dependency_job_id":"72202f54-8bd9-404a-ba82-de5e0bd19259","html_url":"https://github.com/DEFRA/pha-import-notifications","commit_stats":null,"previous_names":["defra/pha-import-notifications"],"tags_count":112,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fpha-import-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fpha-import-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fpha-import-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEFRA%2Fpha-import-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEFRA","download_url":"https://codeload.github.com/DEFRA/pha-import-notifications/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247878023,"owners_count":21011158,"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":["backend","cdp","dotnet","service"],"created_at":"2024-11-05T03:04:21.186Z","updated_at":"2026-05-02T06:37:52.402Z","avatar_url":"https://github.com/DEFRA.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Defra PHA Import Notifications\n\nThis service provides Port Health Authorities (PHAs) access to a mixture of IPAFFS, ALVS, CDS and GVMS data.\n\nThe solution supplies an endpoint for querying for updated records within a certain time period\nand then provides the ability to retrieve all the data for those records.\n\n## Prerequisites\n\nThe solution requires:\n\n- .NET 9\n\n  ```bash\n  brew tap isen-ng/dotnet-sdk-versions\n  brew install --cask dotnet-sdk9\n  ```\n\n- Docker (optional)\n\n## Installation\n\n1. Clone this repository\n2. Install the required tools with `dotnet tool restore`\n3. Check the solution builds with `dotnet build`\n4. Check the service builds with `docker build .`\n\n## Running\n\n1. Run the application via your favourite IDE or via Docker:\n   ```\n   docker build -t pha-import-notifications .\n   docker run -p 8080:8080 \\\n    -e ASPNETCORE_ENVIRONMENT=Development \\\n    -e ENVIRONMENT=Local \\\n    pha-import-notifications\n   ```\n2. Navigate to http://localhost:8080/redoc\n\n## Endpoints\n\nThe endpoints are detailed in the OpenAPI spec which is available either via the Redoc URL,\nor alternatively via the [OpenAPI Spec URL](http://localhost:8080/.well-known/openapi/v1/openapi.json).\n\nA JWT is required to authenticate the user when making requests.  \nA local one can be generated by running `./scripts/generate-jwt.sh` and then including it as a `Bearer` token in the `Authorization` header.\n\nGet all updated import notifications within a time period:\n```http request\nhttp://localhost:8080/import-notifications?bcp=BCP1\u0026from=2025-02-12T12:00:00+00:00\u0026to=2025-02-12T12:30:00+00:00\n```\n\nGet an import notification:\n```http request\nhttp://localhost:8080/import-notifications/CHEDA.GB.2024.4792831\n```\n\n## Update Trade Imports Data Schema\n\nWhen a schema change in Trade Data Imports is made we need to update our models.\n\nAt the moment this is a manual process:\n\n1. Fetch the `openapi.json` artifact from the latest build of [trade-imports-data-api](https://github.com/defra/trade-imports-data-api/actions/workflows/publish.yml?query=branch%3Amain)\n2. In the PHA API repository, extract and copy this to the tools/SchemaToCSharp folder\n3. Run `make update-tradeimportsdataapi-schema` in the root of the repository\n4. Observe any changes that have been made and commit them\n\n## Update Trade Imports Data Stub Scenarios\n\nFollowing a schema change, we need to update the response JSON that Trade Imports Data will give us.\n\nAt the moment this is a manual process:\n\n1. Checkout main from [trade-imports-data-api](https://github.com/defra/trade-imports-data-api)\n2. Locate the integration test called `ShouldImportPhaStubScenario`\n3. Update the test so it will save the generated output\n4. Understand and act on any redaction work needed before committing anything\n5. Run the test and take the output from the generated `PhaScenarioTestsOutput` folder\n6. Replace the [TradeImportsDataApiStub/Scenarios folder](tests/TradeImportsDataApiStub/Scenarios) in this repo with the contents of the folder above\n7. Do the same for the [Trade Imports Data Stub Scenarios](https://github.com/DEFRA/trade-imports-data-api-stub/tree/main/src/Stub/Scenarios)\n8. Observe any changes that have been made and commit them\n\n## Development\n\nIt is possible to configure the PHA API to query a deployed Trade Imports Data instance.\n\nFill out the [TradeImportsDataApiOptions](./src/Api/Configuration/TradeImportsDataApiOptions.cs) configuration to point at a Trade Imports Data instance and then\nperform a request to the PHA API whilst connected to the VPN.\n\nThe `Username` and `Password` are Basic Auth credentials.\n\n## Testing\n\nThe unit and integration tests can either be run via your IDE or alternatively with `dotnet test .`\n\nA SonarCloud setup will run static analysis on the code when raising a PR.\n\n# Linting\n\nWe use [CSharpier](https://csharpier.com) to lint our code.\n\nYou can run the linter with `dotnet csharpier check .`\n\n## License\n\nThis project is licensed under The Open Government Licence (OGL) Version 3.  \nSee the [LICENSE](./LICENSE) for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fpha-import-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefra%2Fpha-import-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefra%2Fpha-import-notifications/lists"}