81f8c6ec1fe44f4fba9c7a7342a.../README.md
2025-04-07 11:25:16 +00:00

71 lines
1.9 KiB
Markdown

# Creation of an ILI report
A function that will create a ILI report asset and sequence.
## Input
### Arguments
- `pipeline_id`: a `string` which should be a valid uuid for a pipeline.
- `date`: a `string` formatted as an ISO date representing the date of the
inspection.
- `vendor_name`: a `string` the company who conducted the ILI inspection
- `report_type`: a `string` the type of the report possible values:
- `final`
- `preliminary`
- `inspection_type`: a `string` the type of technology used possible values:
- `mfl`
- `tfi`
- `ut`
- `emat`
- `caliper`
- `combo_mfl_and_tfi`
- `combo_mfl_and_ut`
- `combo_mfl_and_ec`
- `file_details`: a `object` representing uploaded report file.
- `pipebody_tolerances`: an `object` representing the tolerances for the pipebody
- `haz_tolerances`: an `object` representing the tolerances for the heat affected zone (HAZ)
### Environment
- `ORG_ID`: the organization id
- `PROJECT_ID`: the id of the data project where the pipeline data is found
- `ENV`: the environment of the platform e.g. `dev` or `stg` etc.
## 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/ili_creation \
-n uploadili \
-d "Processes an ILI file and create the sequences and assets associated with that report" \
-i pipeline_id=string \
-i date=string \
-i vendor_name=string \
-i report_type=string \
-i inspection_type=string \
-i file_details=object \
-i pipebody_tolerances=object \
-i haz_tolerances=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 -X POST localhost:8080 -v \
-d "\"{\\\"pipeline_id\\\": \\\"0195a527-f16b-7d83-b936-35bc2dd92f9d\\\"}\""
```