This service provides Port Health Authorities (PHAs) access to a mixture of IPAFFS, ALVS, CDS and GVMS data.
The solution supplies an endpoint for querying for updated records within a certain time period and then provides the ability to retrieve all the data for those records.
The solution requires:
-
.NET 9
brew tap isen-ng/dotnet-sdk-versions brew install --cask dotnet-sdk9
-
Docker (optional)
- Clone this repository
- Install the required tools with
dotnet tool restore
- Check the solution builds with
dotnet build
- Check the service builds with
docker build .
- Run the application via your favourite IDE or via Docker:
docker build -t pha-import-notifications . docker run -p 8080:8080 \ -e ASPNETCORE_ENVIRONMENT=Development \ -e ENVIRONMENT=Local \ pha-import-notifications
- Navigate to http://localhost:8080/redoc
The endpoints are detailed in the OpenAPI spec which is available either via the Redoc URL, or alternatively via the OpenAPI Spec URL.
A JWT is required to authenticate the user when making requests.
A local one can be generated by running ./scripts/generate-jwt.sh
and then including it as a Bearer
token in the Authorization
header.
Get all updated import notifications within a time period:
http://localhost:8080/import-notifications?bcp=BCP1&from=2025-02-12T12:00:00+00:00&to=2025-02-12T12:30:00+00:00
Get an import notification:
http://localhost:8080/import-notifications/CHEDA.GB.2024.4792831
When a schema change in Trade Data Imports is made we need to update our models.
At the moment this is a manual process:
- Fetch the
openapi.json
artifact from the latest build of trade-imports-data-api - In the PHA API repository, extract and copy this to the tools/SchemaToCSharp folder
- Run
make update-tradeimportsdataapi-schema
in the root of the repository - Observe any changes that have been made and commit them
Following a schema change, we need to update the response JSON that Trade Imports Data will give us.
At the moment this is a manual process:
- Checkout main from trade-imports-data-api
- Locate the integration test called
ShouldImportPhaStubScenario
- Update the test so it will save the generated output
- Understand and act on any redaction work needed before committing anything
- Run the test and take the output from the generated
PhaScenarioTestsOutput
folder - Replace the TradeImportsDataApiStub/Scenarios folder in this repo with the contents of the folder above
- Do the same for the Trade Imports Data Stub Scenarios
- Observe any changes that have been made and commit them
It is possible to configure the PHA API to query a deployed Trade Imports Data instance.
Fill out the TradeImportsDataApiOptions configuration to point at a Trade Imports Data instance and then perform a request to the PHA API whilst connected to the VPN.
The Username
and Password
are Basic Auth credentials.
The unit and integration tests can either be run via your IDE or alternatively with dotnet test .
A SonarCloud setup will run static analysis on the code when raising a PR.
We use CSharpier to lint our code.
You can run the linter with dotnet csharpier check .
This project is licensed under The Open Government Licence (OGL) Version 3.
See the LICENSE for more details.