268ef8c47f2c4796b96449aed4e.../README.md
2025-08-01 10:37:33 +00:00

74 lines
2.4 KiB
Markdown

# Segment growth rate
The segment growth rate calculation is useful when the ILI comparison is unable to get good
results.
Before performing any comparison or analysis between two ILI reports, the user must verify the
following parameters are consistent across both inspections:
- *Detection Threshold*: Ensure the detection threshold is the same in both ILI reports.
- *Reporting Threshold*: Ensure the reporting threshold is the same in both ILI reports.
- *Tool Tolerances*: Ensure the specified tool tolerances are the same in both ILI reports.
Failure to verify these parameters may result in inaccurate comparison or false growth
assessments.
## 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`: a `array` of string values representing a valid `uuid` for a pipeline
- `older_ili_id`: a `array` of string values representing a valid `uuid` for an ili report sequence
- `newer_ili_id`: a `array` of string values representing a valid `uuid` for an ili report sequence
- `initial_segment_length`: a `float` value
- `depth_histogram_width`: a `float` value
- `length_histogram_width`: a `float` value
- `maximum_segment_length`: a `float` value
- `minimum_segment_length`: a `float` value
- `growth_rate_type`: a `string` whose values should be one of
- `mean`
- `maximum`
- `confidence`: a `string` whose value should be one of
- `high`
- `low`
## 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_segment_growth_rate \
-d "Run the segment growth rate calculation" \
-i org_id=string \
-i project_id=string \
-i pipeline_id=array \
-i older_ili_id=array \
-i newer_ili_id=array \
-i initial_segment_length=integer \
-i growth_rate_type=string \
-i depth_histogram_width=float \
-i length_histogram_width=float \
-i confidence=float \
-i maximum_segment_length=float \
-i minimum_segment_length=float
```
## 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_segment_growth_rate/example_input.json)
```