Go to file
2025-06-12 21:07:33 +00:00
src Automatic push from FunctionsAPI 2025-06-12 21:07:33 +00:00
Cargo.lock Automatic push from FunctionsAPI 2025-06-12 21:07:33 +00:00
Cargo.toml Automatic push from FunctionsAPI 2025-06-12 21:07:33 +00:00
example_input.json Automatic push from FunctionsAPI 2025-06-12 21:07:33 +00:00
README.md Automatic push from FunctionsAPI 2025-06-12 21:07:33 +00:00

Dynamic segmentation function

A function that exposes the dynamic segmentation algorithm for the pipeline use case.

This function will recompute the segmentation for all pipelines based on the provided segmentation configuration

Segmentation is the process of taking local data, crossings, and facilities on the pipeline and creating pipeline segments where this local data changes (a cut line).

In fathom we support dynamic segmentation where the user is able to configure the properties they would like to consider when segmentizing and to support re-segmentizing the pipeline at any point such as when new data is available from an ILI report.

Segmentation can be dynamically configured to consider the following properties

  • pipeline diameter (currently required)
  • wall thickness (currently required)
  • material grade
  • coating type
  • design factor
  • high consequence area
  • unusual sensitive area
  • join type
  • soil type
  • soil ph

Additionally the following crossing types can be considered

  • Road
  • River
  • Railroad
  • Overhead
  • Highway
  • Pipeline

Finally, the following facilities can also be used to create cut lines

  • Valves
  • Insulation joints
  • Repairs

The user is able to configure which the the local properties and which of the crossing and facility types they would like to consider for creating the segmentation. For the purpose of the analytics required later in the process we require the user segments on diameter and wall thickness. The other properties are optional.

Example

diameter       ├──────────────────────────┼────────────────────────────────────┤
                         40 inch                          42 inch
wall thickness ├───────┼─────────────────────────────────────────────────┼─────┤
                 12.0                         9.0                          12.0
material grade ├──────────────────────────┼──────────────────────────────┼─────┤
                         L290                             L320
design factor  ├─────────────────────────────────────────────────────────┼─────┤
                                            L72
road crossing                     ├──┤                      ├──┤
river crossing      ├──┤                                          ├──┤
valve            │                                                          │
repair                                         ├─┤


segments       ├─┼──┼──┼──────────┼──┼────┼────┼─┼──────────┼──┼──┼──┼───┼──┼──┤
                1 2  3      4      5    6    7  8     9      10 11 12 13  14 15

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
  • facilities: an array of string each value should be one of
    • insulation_joint
    • repair
    • valve.
  • crossings: an object with key for each supported crossing type and values as objects representing the selected values
  • local_data: an array of string each value should be one of
    • material_grade
    • coating_type
    • design_factor
    • high_consequence_area
    • unusual_sensitive_area
    • joint_type
    • soil_type
    • soil_ph

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/segmentation \
  -d "Runs the segmentation algorithm for the provided pipelines" \
  -i org_id=string \
  -i project_id=string \
  -i pipeline_id=array \
  -i facilities=array \
  -i crossings=object \
  -i local_data=array

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

curl localhost:8080 -d $(jq '. | tojson' functions/segmentation/example_input.json)