1b48efe5d69e4b8292e19581629.../README.md
2025-06-10 16:44:20 +00:00

56 lines
1.7 KiB
Markdown

# Long term corrosion rate.
This is calculated using a chosen ILI report and the growth rate is calculated on the
assumption that the growth rate has been constant since the creation of the pipeline.
At it's most fundamental the calculation is simply `p / t` where `p` is the property (either
the depth or length of the anomaly) and `t` is the time gap between the creation of the
pipeline and the ILI report date.
## Input
### Arguments
- `org_id`: as string which should be a valid `uuid` for the organization
- `project_id`: the id of the data project where the pipeline data is found
- `pipeline_id`: an `array` of `strings` which should be valid UUIDs for pipelines
- `ili_id`: an `array` of `strings` which should be valid UUIDs for ili sequences
- `aggregation`: an `string` each value should be one of the following
- `segment`
- `pipeline`
- `girth_weld`
- `every_1_km`
- `every_5_km`
- `every_10_km`
## Creating the function on the platform
To create this function on the platform using the `cli` set up the port forwarding as shown in README.
Then run the following command to create the function.
```bash
cargo run functions create \
-f functions/acr_long_term_corrosion_growth_rate \
-d "Run the long term corrosion growth rate calculation on using the provided ILI" \
-i org_id=string \
-i project_id=string \
-i pipeline_id=array \
-i ili_id=array \
-i aggregation_method=object
```
## Testing the function locally
You can run and test the function locally by running
```bash
cargo run
```
Then you can check it work with `curl` as follows
```bash
curl localhost:8080 -d $(jq '. | tojson' functions/acr_long_term_corrosion_growth_rate/example_input.json)
```