2.0 KiB
2.0 KiB
Corrosion coupon report upload
Approximately every 90 days during the entire lifetime of an active pipeline the corrosion coupon in a corrosion coupon retrieval point should be replaced. The removed coupon should be weighed to assess the metal loss of the coupon during the days it was exposed in the pipeline.
Input
Arguments
org_id: as string which should be a validuuidfor the organizationproject_id: the id of the data project where the pipeline data is foundpipeline_id: anarrayofstringswhich should be valid UUIDs for pipelinescoupon_retrieval_point_id: anarrayofstringswhich should be valid UUIDs for coupon retrieval points on the pipelineinstallation_date: astringformatted as an ISO date representing the date the corrosion coupon was installed in the pipeline.retrieval_date: astringformatted as an ISO date representing the date the corrosion coupon was retrieved from the pipeline.metal_loss: afloatrepresenting the measured metal loss of the coupon.inspector: astringrepresenting the identifier of the inspectorremarks: astringfor any additional remarks about the inspection
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.
cargo run functions create \
-f functions/corrosion_coupon_report \
-d "Creates new corrosion coupon reports" \
-i org_id=string \
-i project_id=string \
-i pipeline_id=array \
-i coupon_retrieval_point_id=array \
-i installation_date=string \
-i retrieval_date=string \
-i metal_loss=float \
-i inspector=string \
-i remarks=string
Testing the function locally
You can run and test the function locally by running
cargo run
Then you can check it work with curl as follows
jq '. | tojson' functions/corrosion_coupon_report/example_input.json | curl -d '@-' localhost:8080