b597d919aef7434eb4606fd285c.../README.md
2025-07-31 09:22:12 +00:00

3.1 KiB

Add soil resistivity report

Soil resistivity reports

Soil resistivity is a critical parameter in the design of CP systems because:

  • It affects current distribution from the anode to the pipe.
  • Low resistivity soils (e.g., wet clays) are more conductive and easier to protect pipelines in.
  • High resistivity soils (e.g., dry sand, rock) require more power or more anodes to achieve protection.

Testing soil resistivity (typically via the Wenner 4-pin method) helps determine:

  • CP system design and layout
  • Anode type, spacing, and depth
  • Expected current requirement and life of anodes

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
  • inspection_date: a string formatted as an ISO date representing the date of the soil resistivity report
  • starting_point: a float representing the log distance of the starting point of the soil type
  • ending_point: a float representing the log distance of the end point of the soil type
  • soil_type: a string the soil type for the current section of the pipeline possible values
    • clay
    • sand
    • silt
  • resistivity: a float representing the recorded value of the soil's electrical resistivity at this point and time
  • soil_temperature: a float representing the recorded value of the soil temperature at this point and time
  • cp_practice: a string the cathode protection for this section of the pipeline.
    • no_cp: No cathode protection
    • no_cp_adjacent_risk: No cathode protection with risk of stray current from adjacent structure
    • cp_outside: Cathode protection outside of NACE regulation
    • cp_on: Cathode protection inline with NACE instance on regulation
    • cp_off: Cathode protection inline with NACE instance off regulation
  • coating_repair_schedule: a string coating repair schedule
    • repaired_or_regularly_replaced: Coating regularly repaired or replaced
    • never_or_rarely_replaced: Coating never or rarely replaced
  • inspector: a string representing the identifier of the inspector
  • remarks: a string for 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/soil_resistivity \
  -d "Add a soil resistivity report" \
  -i org_id=string \
  -i project_id=string \
  -i pipeline_id=array \
  -i inspection_date=string \
  -i starting_point=float \
  -i ending_point=float \
  -i soil_type=string \
  -i resistivity=float \
  -i soil_temperature=float \
  -i cp_practice=string \
  -i coating_repair_schedule=string \
  -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/soil_resistivity/example_input.json | curl -d '@-' localhost:8080