# Creation of an ILI report A function that will create a ILI report asset and sequence. ## 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` each item of 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 `array` of file detail objects - `pipebody_tolerances`: an `object` representing the tolerances for the pipebody - `haz_tolerances`: an `object` representing the tolerances for the heat affected zone (HAZ) ## 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 \ -d "Processes an ILI file and create the sequences and assets associated with that report" \ -i org_id=string \ -i project_id=string \ -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 "\"{\\\"date\\\": \\\"Fri Feb 01 2002\\\", \\\"file_details\\\": [{\\\"fileId\\\": \\\"a2e8295f-3547-47b1-92ae-d5446b081eee\\\", \\\"revisionId\\\": \\\"2c68f624-2e9b-4c4a-90e0-d0243bd5c541\\\"}], \\\"formData\\\": {\\\"inpsectionType\\\": \\\"mfl\\\", \\\"pipeline_datasetIds\\\": \\\"\\\", \\\"pipeline_organizationId\\\": \\\"2cbfe270-d195-48ad-aed1-24145924635c\\\", \\\"pipeline_resourceClientIds\\\": [\\\"pipeline-1-local-data\\\"], \\\"pipeline_resourceIds\\\": [\\\"6f9ad309-d882-46af-bb13-ce06ac8c38a5\\\"], \\\"pipeline_resourceTypeId\\\": 6, \\\"pipeline_workspaceId\\\": null, \\\"reportDate\\\": \\\"Fri Feb 01 2002\\\", \\\"reportFile\\\": [{\\\"fileId\\\": \\\"a2e8295f-3547-47b1-92ae-d5446b081eee\\\", \\\"revisionId\\\": \\\"2c68f624-2e9b-4c4a-90e0-d0243bd5c541\\\"}], \\\"reportType\\\": \\\"final\\\", \\\"toolToleranceForHaz\\\": \\\"{\\\\\\\"general_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"general_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"general_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"general_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"general_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"pitting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"pitting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pitting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pitting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"axial_grooving_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"axial_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"circumferential_grooving_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"circumferential_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_sensitivity\\\\\\\":\\\\\\\"2\\\\\\\",\\\\\\\"pinhole_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"pinhole_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"axial_slotting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"axial_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"circumferential_slotting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"circumferential_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\"}\\\", \\\"toolTolerancesForPipeBody\\\": \\\"{\\\\\\\"general_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"general_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_width\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"general_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_length\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"general_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"pitting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"pitting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"pitting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_depth\\\\\\\":\\\\\\\"0.2\\\\\\\",\\\\\\\"axial_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"axial_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"axial_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"circumferential_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"circumferential_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"circumferential_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_depth\\\\\\\":\\\\\\\"0.2\\\\\\\",\\\\\\\"pinhole_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_depth\\\\\\\":\\\\\\\"0.19\\\\\\\",\\\\\\\"axial_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"circumferential_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_width\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"circumferential_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"circumferential_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\"}\\\", \\\"vendorName\\\": \\\"ILI-Ros\\\"}, \\\"haz_tolerances\\\": \\\"{\\\\\\\"general_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"general_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"general_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"general_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"general_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"pitting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"pitting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pitting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pitting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"axial_grooving_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"axial_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"circumferential_grooving_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"circumferential_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_sensitivity\\\\\\\":\\\\\\\"2\\\\\\\",\\\\\\\"pinhole_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"pinhole_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"axial_slotting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"axial_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_sensitivity\\\\\\\":\\\\\\\"3\\\\\\\",\\\\\\\"circumferential_slotting_sensitivity_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"circumferential_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"circumferential_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\"}\\\", \\\"input\\\": null, \\\"inspection_type\\\": \\\"mfl\\\", \\\"pipebody_tolerances\\\": \\\"{\\\\\\\"general_depth\\\\\\\":\\\\\\\"0.15\\\\\\\",\\\\\\\"general_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_width\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"general_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"general_length\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"general_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"pitting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"pitting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pitting_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"pitting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_depth\\\\\\\":\\\\\\\"0.2\\\\\\\",\\\\\\\"axial_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"axial_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_grooving_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"axial_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"circumferential_grooving_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_width\\\\\\\":\\\\\\\"15\\\\\\\",\\\\\\\"circumferential_grooving_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_grooving_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"circumferential_grooving_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_depth\\\\\\\":\\\\\\\"0.2\\\\\\\",\\\\\\\"pinhole_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"pinhole_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"pinhole_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_depth\\\\\\\":\\\\\\\"0.19\\\\\\\",\\\\\\\"axial_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_width\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"axial_slotting_length\\\\\\\":\\\\\\\"20\\\\\\\",\\\\\\\"axial_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_depth\\\\\\\":\\\\\\\"0.13\\\\\\\",\\\\\\\"circumferential_slotting_depth_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_width\\\\\\\":\\\\\\\"19\\\\\\\",\\\\\\\"circumferential_slotting_width_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\",\\\\\\\"circumferential_slotting_length\\\\\\\":\\\\\\\"13\\\\\\\",\\\\\\\"circumferential_slotting_length_inputType\\\\\\\":\\\\\\\"short_text\\\\\\\"}\\\", \\\"org_id\\\": \\\"2cbfe270-d195-48ad-aed1-24145924635c\\\", \\\"pipeline_id\\\": [\\\"01966d47-1d4c-7751-a1f1-0617caa3a00d\\\"], \\\"project_id\\\": \\\"680b61b0aedd6f9e639d8699\\\", \\\"report_type\\\": \\\"final\\\", \\\"vendor_name\\\": \\\"ILI-Ros\\\"}\""" ```