This API allows users to identify Output Areas (OA) and Industry Classification (SIC) associated with a given location. OAs are small geographical areas in the UK used for statistical purposes, while SIC codes are a system of numerical codes used to identify and categorize industries.
The API takes a single, multiple or partial OA/SIC codes as input and returns a list of associated OAs and SIC information. Additionally, users can retrieve detailed information about the areas associated with each OA code.
make help
- Displays a help menu with availablemake
scriptsmake all
- Runs audit test and build commandsmake audit
- Audits and finds vulnerable dependenciesmake build
- Builds ./Dockerfile image name: nlp_hubmake build-bin
- Build bin file in folder buildmake clean
- Removes /bin foldermake convey
- Runs only convey testsmake debug
- Runs application locally with debug mode onmake fmt
- Formats the code using go fmt and go vetmake lint
- Automated checking of your source code for programmatic and stylistic errorsmake run
- Runs container name: hub from image name: nlp_hubmake run-locally
- Runs the app locallymake test
- Runs all tests with -cover -race flagsmake test-component
- Test componentsmake update
- Go gets all of the dependencies and downloads them
Environment variable | Default | Description |
---|---|---|
AREA_DATA_FILE | data/2011 OAC Clusters and Names csv v2.csv |
The data files with the areas |
BIND_ADDR | :28700 | The host and port to bind to |
GRACEFUL_SHUTDOWN_TIMEOUT | 5s | The graceful shutdown timeout in seconds (time.Duration format) |
HEALTHCHECK_INTERVAL | 30s | Time between self-healthchecks (time.Duration format) |
HEALTHCHECK_CRITICAL_TIMEOUT | 90s | Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format) |
INDUSTRY_DATA_FILE | data/SIC07_CH_condensed_list_en.csv |
The data files with the industries |
make run
make update
go run .
Running the project either locally or in docker will expose port 28700.
curl 'http://localhost:28700/health'
This will return results of the form:
{
"status": "OK",
"version": {
"build_time": "2020-09-26T14:30:18+03:00",
"git_commit": "6584b786caac36b6214ffe04bf62f058d4021538",
"language": "go",
"language_version": "go1.19.5",
"version": "v0.1.0"
},
"uptime": 7771,
"start_time": "2023-03-09T07:46:43.587143363Z",
"checks": []
}
curl 'http://localhost:28700/scrubber?q=dentists%20in%20london'
This will return results of the form:
{
"time": "4µs",
"query": "dentists",
"results": {}
}
If you search for an area output code like: E00000014 and an industry code like: 01140
curl 'http://localhost:28700/scrubber?q=dentists%20in%20E00000014%2001140'
This will return results of the form:
{
"time": "55µs",
"query": "dentists in E00000014 01140",
"results": {
"areas": [
{
"name": "City of London",
"region": "London",
"region_code": "E12000007",
"codes": {
"E00000014": "E00000014"
}
}
],
"industries": [
{
"code": "01140",
"name": "Growing of sugar cane"
}
]
}
}
See CONTRIBUTING for details.
Copyright © 2023, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.