openapi: 3.0.3 info: title: AEA Engine API version: 1.17.0 description: | The DrillPlan AEA Extensibility allows validation results from external system to be included in DrillPlan. By integrating with DrillPlan’s coherency and validation infrastructure, all users can seamlessly rely on multiple validation sources to produce a Drilling Program. # Quick-start - Step 1 - Create external engine - Step 2 - Declaring metadata, register engine and return results ## Step 1 - Create external engine When creating an external engine, there are three equally important blocks that needs attention: - Implementation of the DrillPlan AEA External Engine API - The validation engine - the engine producing the validation result - Hosting and security ### Step 1.1 - Implementation of the DrillPlan AEA External Engine API There are no requirements in how you choose to implement the OAS specification. We do however recommend that you rely on code generation to easier adopt changes and updates of the specification. One option for generating your external engine is [openapi.tools](https://openapi.tools/) and their docker image [openapi-generator-cli](https://hub.docker.com/r/openapitools/openapi-generator-cli). Generation can be done using the following command: ``` bash docker run --rm -v ${PWD}:/app openapitools/openapi-generator-cli:v5.1.0 generate \ --input-spec /app/agent.yaml \ --output /app/dist \ --package-name Aea.Example.Engine \ --import-mappings ProblemDetails=Microsoft.AspNetCore.Mvc.ProblemDetails \ --additional-properties aspnetCoreVersion=3.1 \ --additional-properties packageTitle=Aea.Example.Engine \ --generator-name aspnetcore //Run the following commands to complete code generation cd dist sed -i 's/JsonConverter(typeof(JsonSubtypes), "Type")/JsonConverter(typeof(JsonSubtypes), "$type")/g' src/Aea.Example.Engine/Models/PreviewResultBase.cs sed -i 's/JsonConverter(typeof(JsonSubtypes), "Type")/JsonConverter(typeof(JsonSubtypes), "$type")/g' src/Aea.Example.Engine/Models/ResultBase.cs ``` This will generate a C# aspnetcore service, Aea.Example.Engine, which can be connected to DrillPlan. To run, execute the following steps ``` bash cd dist ./build.sh dotnet src/Aea.Example.Engine/bin/Debug/netcoreapp3.1/Aea.Example.Engine.dll ``` You can now access the api specification on [http://localhost:8080/openapi/index.html](). Metadata and validations example results can be viewed by: - [http://localhost:8080/metadata]() - [http://localhost:8080/validations/123]() ### Step 1.2 - The validation engine With the DrillPlan AEA interface implemented, next piece is the actual validation. Here there are multiple options, but for simplicity we would just extend what you have already generated to respond on the in-coming request to validate and return a response. ### Step 1.3 - Hosting and security There are no hosting requirements other than that the external engine must be accessible by DrillPlan. All engine registrations in DrillPlan will rely on OAuth2 client credentials flow and requires valid TLS certificates. Supported TLS protocols are 1.2 and 1.3. ## Step 2 - Declaring metadata, register engine and return results Both `/metadata` and `/validations/{validationId}` have examples that shows valid responses and can be connected to DrillPlan. The registration of an external engine is not part of this schema documentation and can be found on the [Delfi Developer Portal]([https://](https://p4d.developer.delfi.cloud.slb-ds.com/solutions/drillplan/tutorials/aeaextensibility)) paths: /metadata: get: tags: - Metadata summary: >- Returns AEA Agent metadata. Specify required input types, your result placeholders and under which validation scope your agent will be running. DrillPlan AEA will also rely on this endpoint as a heartbeat. responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/AgentMetadata' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' /validations: post: tags: - Validation summary: Create a validation. The input is based on declared metadata. See example requestBody: content: application/json: schema: $ref: '#/components/schemas/ValidationStart' responses: '204': description: Success '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' '/validations/{validationId}': get: tags: - Validation summary: | Find a validation by ID. This allows to report progress, status and your results to DrillPlan AEA through messages, preview results, parameterized results with unit conversion support and charts parameters: - name: validationId in: path required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/Validation' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' delete: tags: - Validation summary: Delete a valiadtion. Upon a completed validation, DrillPlan AEA will issue a delete request to allow for resource clean up. parameters: - name: validationId in: path required: true schema: type: string responses: '204': description: Success '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' components: responses: NotFound: description: Resource not found content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' InternalServerError: description: Internal server error content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' Unauthorized: description: Unauthorized content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' schemas: ProblemDetails: type: object description: Problem details according to RFC7807 required: - type - title - detail properties: type: type: string maxLength: 64 title: type: string maxLength: 128 detail: type: string maxLength: 512 AgentIdentity: type: object required: - name - version example: name: test version: '1' properties: name: type: string maxLength: 64 version: type: string InputType: type: object required: - type_id properties: type_id: type: string description: | A valid AEA input type. Supported input types are * bha_tool_string-v6 * effective_drilling_fluid-v1 * effective_operation_parameters-v1 * run-v1 * trajectory_design-v1 * wbg_profile_at_drilling_run_end-v1 Depending on your validation scope, you may require collections of a given type. Apply the following format: **[]**, e.g. effective_operation_parameters-v1[] maxLength: 64 is_optional: type: boolean description: >- If true, a validation will not be triggered unless this object is defined in DrillPlan project ValidationResultPlaceholder: type: object required: - id - category - name properties: id: type: string description: The unique identifier of the validation result card. maxLength: 64 name: type: string description: The name of the validation result card. maxLength: 64 category: type: string description: The title of the visual group of validation results. maxLength: 64 ValidationScope: enum: - Well - Wellbore - Section - Run type: string example: Run description: >- This outlines how the DrillPlan AEA infrastructure will extract data. This is similar to the DrillPlan project structure. If on 'Run' level, only the object edited on that specific run will be included in the data-set. By moving up to 'Wellbore' or higher, will allow you to require collections of section or run level objects. AgentMetadata: type: object required: - agent - input_metadata - result_placeholders - scope example: agent: name: test version: '1' input_metadata: - type_id: bha_tool_string-v6 is_optional: false - type_id: effective_drilling_fluid-v1 is_optional: false - type_id: 'effective_operation_parameters-v1[]' is_optional: true - type_id: run-v1 is_optional: false - type_id: trajectory_design-v1 is_optional: false - type_id: wbg_profile_at_drilling_run_end-v1 is_optional: false visualizations: example_chart: tracks: - curves: null fill: - key: planned_wob label: L1 from: planned_min_wob to: planned_max_wob style: color: '#75CDFF' opacity: 0.5 pattern: solid palette: null - key: rotating_wob label: L2 from: rotating-tension-wob to: rotating_compression_wob style: color: '#EB8180' opacity: 0.5 pattern: solid palette: null heatmap: fillsOverlap: - fillsKeys: - planned_wob - rotating_wob label: L3 grid: null orientation: vertical indexDirection: direct indexTrack: null result_placeholders: - id: example-validation-id-01 name: 'Example Validation #1' category: Examples agents - id: example-validation-id-02 name: 'Example Validation #2' category: Examples agents scope: Run package_version: 1.0.0 cache_option: Enabled agent_dependencies: - name: PressureEngine version: 3.0.0 properties: agent: $ref: '#/components/schemas/AgentIdentity' input_metadata: type: array maxItems: 24 items: $ref: '#/components/schemas/InputType' visualizations: $ref: '#/components/schemas/Visualizations' result_placeholders: type: array maxItems: 16 items: $ref: '#/components/schemas/ValidationResultPlaceholder' description: >- Result placeholders declare the initial view of the validation UI until it is updated. scope: $ref: '#/components/schemas/ValidationScope' package_version: type: string description: >- If not specified, this parameter will be set with the version of assembly (preferred way). Package version takes part in hashing, so updated package would not share previous cache. cache_option: $ref: '#/components/schemas/CacheOption' agent_dependencies: type: array maxItems: 16 items: $ref: '#/components/schemas/AgentDependency' description: >- Declaration of dependencies to other validation engines (agents). CacheOption: type: string enum: - Enabled - Disabled - Default description: | Option to set caching on engine results: * `Enabled` - Result is cached. * `Disabled` - Result is not cached. * `Default` - Currently results are cached by default. This is selected if no cache option is set. MessageSeverity: enum: - Info - Warning - Error - Unknown type: string description: | The message severity: * `Info` - Indicates an informational message with a green check box icon. * `Warning` - Indicates a warning message wiht a yellow exclamation mark icon. * `Error` - Indicates a validation error with a red cross icon. * `Unknown` - Indicates a message of unknown type with a gray question mark icon. PreviewResultBase: type: object properties: $type: type: string maxLength: 64 required: - $type discriminator: propertyName: $type ResultBase: type: object properties: $type: type: string maxLength: 64 name: type: string maxLength: 64 required: - $type - name discriminator: propertyName: $type SingleResult: allOf: - $ref: '#/components/schemas/ResultBase' type: object required: - value example: name: Status value: 30.5 measurement: HighForce $type: SingleResult url: https://validation-domain/validation/77ff5c67-c369-463b-8bc5-03d6d45fb753 properties: value: type: number format: double measurement: type: string maxLength: 64 description: >- Measurement is an identifier of the measurement of the quantity of the provided values, e.g., Pressure, Velocity, Temperature, etc. display_decimal_place: type: number format: integer description: >- Decimal places for numbers displayed on AEA cards. url: type: string maxLength: 2000 pattern: '^https:\/\/.+' description: >- Url link that can point to validation results. PreviewValueResult: allOf: - $ref: '#/components/schemas/PreviewResultBase' type: object required: - value example: value: 2.342 $type: PreviewValueResult measurement: Velocity properties: value: type: number format: double measurement: type: string maxLength: 64 description: >- Measurement is an identifier of the measurement of the quantity of the provided values, e.g., Pressure, Velocity, Temperature, etc. display_decimal_place: type: number format: integer description: >- Decimal places for numbers displayed on AEA cards. PreviewTextResult: allOf: - $ref: '#/components/schemas/PreviewResultBase' type: object required: - text example: text: Section 32.5" $type: PreviewTextResult properties: text: type: string maxLength: 64 ParameterizedResult: allOf: - $ref: '#/components/schemas/ResultBase' type: object required: - template - parameters example: name: Status template: 'Hookload {hookload-key}' parameters: - key: hookload-key value: 30.5 measurement: HighForce $type: ParameterizedResult url: https://validation-domain/validation/77ff5c67-c369-463b-8bc5-03d6d45fb753 properties: template: type: string maxLength: 380 description: > The template might contain placeholders for parameters. For example, 'Recommended density:{recommended_denisty}' There should be the corresponding parameter in 'parameters' with the `key` field containing 'recommended_density' value. Then, at the rendering time, the placeholder will be replaced with the value and display units, based on measurement and client's unit system. parameters: type: array maxItems: 16 items: $ref: '#/components/schemas/Parameter' description: >- Parameters are used at client side to unit-convert part of the string values url: type: string maxLength: 2000 pattern: '^https:\/\/.+' description: >- Url link that can point to validation results. DataSeriesResult: allOf: - $ref: '#/components/schemas/ResultBase' type: object required: - key - index - series example: key: example_chart name: Virtual hydraulics snapshot example $type: DataSeriesResult index: name: Depth measurement: StandardDepthIndex values: - 0 - 100 - 1900 series: - series_group: series_group_mock name: Flow Regime measurement: Flowrate values: - 0 - 0 - 0 parameters: - value: -180 measurement: Pressure key: order_heatmap_key_mock properties: key: type: string description: > This string should corresond to the visualization key in the map of visualizations in metadata. maxLength: 64 index: $ref: '#/components/schemas/IndexSeries' series: type: array maxLength: 32 items: $ref: '#/components/schemas/DataSeries' IndexSeries: type: object required: - name - values properties: name: type: string maxLength: 64 measurement: type: string maxLength: 64 description: >- Measurement is an identifier of the measurement of the quantity of the provided values, e.g., Pressure, Velocity, Temperature, etc. values: type: array maxLength: 1024 items: type: number format: double nullable: true DataSeries: type: object required: - name - series_group - values properties: name: type: string maxLength: 64 series_group: type: string maxLength: 64 measurement: type: string maxLength: 64 description: >- Measurement is an identifier of the measurement of the quantity of the provided values, e.g., Pressure, Velocity, Temperature, etc. values: type: array maxLength: 1024 items: type: number format: double nullable: true legend: $ref: '#/components/schemas/ParameterizedResult' parameters: type: array maxLength: 16 items: $ref: '#/components/schemas/DataSeriesParameter' description: >- Parameters are used at client side to unit-convert part of the string values. DataSeriesParameter: allOf: - $ref: '#/components/schemas/Parameter' type: object required: - name properties: name: type: string maxLength: 64 description: >- The name of the parameter shown on the AEA Chart Parameter: type: object required: - key - value properties: key: type: string maxLength: 64 description: >- A unique identifier used for replacing placeholders in `ParameterizedResult.description` and `Message.description` with the actual value and measurement. value: type: number format: double measurement: type: string maxLength: 64 description: >- Measurement is an identifier of the measurement of the quantity of the provided values, e.g., Pressure, Velocity, Temperature, etc. display_decimal_place: type: number format: integer description: >- Decimal places for numbers displayed on AEA cards. Message: type: object required: - severity - template example: severity: Info template: 'Message with multiple {parameter-key} {parameter-key2}' parameters: - key: parameter-key value: 5.4 measurement: Pressure properties: severity: $ref: '#/components/schemas/MessageSeverity' template: type: string maxLength: 380 description: > The template might contain placeholders for parameters. For example, 'Recommended density:{recommended_denisty}' There should be the corresponding parameter in 'parameters' with the `key` field containing 'recommended_density' value. Then, at the rendering time, the placeholder will be replaced with the value and display units, based on measurement and client's unit system. suggestion_parameters: type: array items: $ref: '#/components/schemas/SuggestionParameter' description: "Suggestion parameters are similar to ParameterizedStringResult.Parameters,\r\nbut insteald of converting double values for client unit system, it adds a client-specific actions which are embedded in the message." nullable: true parameters: type: array maxLength: 16 items: $ref: '#/components/schemas/Parameter' description: >- Parameters are used at client side to unit-convert part of the string values ValidationResult: type: object required: - placeholder_id example: placeholder_id: example-validation-id-01 messages: - severity: Info template: 'Message with multiple {parameter-key} {parameter-key2}' parameters: - key: parameter-key value: 5.4 measurement: Pressure - key: parameter-key2 value: 17.3 measurement: HighForce preview_result: text: Section 32.5 $type: PreviewTextResult results: - name: Status value: 30.5 measurement: HighForce $type: SingleResult - name: Status Parameterized Result template: 'Hookload {hookload-key}' parameters: - key: hookload-key value: 30.5 measurement: HighForce $type: ParameterizedResult - key: example_chart name: Virtual hydraulics snapshot example index: name: Depth measurement: StandardDepthIndex values: - 0 - 100 - 1900 series: - series_group: series_group_mock name: Flow Regime measurement: Flowrate values: - 0 - 0 - 0 parameters: - value: -180 measurement: Pressure key: order_heatmap_key_mock $type: DataSeriesResult properties: placeholder_id: type: string maxLength: 64 description: >- A unique identifier of the `ValidationResultPlaceholder` where the validation result will be displayed. messages: type: array maxLength: 16 items: $ref: '#/components/schemas/Message' preview_result: $ref: '#/components/schemas/PreviewResultBase' results: type: array maxLength: 16 items: $ref: '#/components/schemas/ResultBase' ValidationStatus: enum: - New - InProcess - Completed - Failed type: string description: | The lifecycle of a calculation: * `New` - The calculation was scheduled, but no update from the agent has been received. * `InProcess` - An update from the agent has been received, but the calculation is not completed. * `Completed` - The calculation has been completed. * `Failed` - The calculation failed. ValidationStart: type: object required: - validation_id - plan - input example: validation_id: 88888888888 validation_type: my-plan site_url: https://eur.drillplan.delfi.slb.com plan: id: 8aa227125cff4d input: bha_tool_string-v6: Omitted. Refer to bha_tool_string-v6 schema for details effective_drilling_fluid-v1: Omitted. Refer to effective_drilling_fluid-v1 schema for details "effective_operation_parameters-v1[]": - Omitted. Refer to effective_operation_parameters-v1 schema for details - Omitted. Refer to effective_operation_parameters-v1 schema for details run-v1: Omitted. Refer to run-v1 schema for details trajectory_design-v1: Omitted. Refer to trajectory_design-v1 schema for details wbg_profile_at_drilling_run_end-v1: Omitted. Refer to wbg_profile_at_drilling_run_end-v1 schema for details dependency_outputs: PressureEngine: results: Omitted. Depends on a concrete engine output. TestEngine: results: Omitted. Depends on a concrete engine output. properties: validation_id: type: string maxLength: 64 description: > A unique identifier of the validation. It is used as the `validationId` parameter in `GET /validations/{validationId}` and `DELETE /validations/{validationId}`. validation_type: type: string maxLength: 64 description: > The validation is triggered in team plan or my plan, the value can be `team-plan` or `my-plan`. site_url: type: string maxLength: 64 description: > DrillPlan site url where the validation is triggered from. plan: $ref: '#/components/schemas/Plan' input: type: object description: >- A key-value map of well-known objects (e.g. Drilling Fluid, BHA etc.). dependency_outputs: type: object additionalProperties: $ref: '#/components/schemas/DependencyOutput' description: >- A dictionary contains key-value pairs for agent dependencies outputs. The key is the agent name of the dependency, the value contains the output object which is following the schema of DrillPlan AEA agent results DependencyOutput: type: object properties: results: type: object description: >- An object which is following the schema of DrillPlan AEA agent results. Plan: type: object required: - id example: id: 8aa227125cff4d properties: id: type: string maxLength: 64 description: A unique identifier of the plan. Validation: type: object required: - id - completion_percent - status - validation_results example: id: 88888888888 completion_percent: 1.0 status: Completed validation_results: - placeholder_id: example-validation-id-01 messages: - severity: Info template: 'Message with multiple {parameter-key} {parameter-key2}' parameters: - key: parameter-key value: 5.4 measurement: Pressure - key: parameter-key2 value: 17.2 measurement: Pressure preview_result: text: Section 32.5 $type: PreviewTextResult results: - name: Status value: 30.5 measurement: HighForce $type: SingleResult - name: Status Parameterized Result template: Hookload {hookload-key} parameters: - key: hookload-key value: 30.5 measurement: HighForce $type: ParameterizedResult - key: example_chart name: Virtual hydraulics snapshot example index: name: Depth measurement: StandardDepthIndex values: - 0 - 100 - 1900 series: - series_group: series_group_mock name: Flow Regime measurement: Flowrate values: - 0 - 0 - 0 parameters: - value: -180 measurement: Pressure key: order_heatmap_key_mock $type: DataSeriesResult - placeholder_id: example-validation-id-02 messages: - severity: Info template: 'Message with multiple {parameter-key} {parameter-key2}' parameters: - key: parameter-key value: 5.4 measurement: Pressure - key: parameter-key2 value: 17.2 measurement: Pressure preview_result: text: Section 12.5 $type: PreviewTextResult results: - name: Status value: 15.5 measurement: HighForce $type: SingleResult properties: id: type: string maxLength: 64 description: A unique identifier of the validation. completion_percent: type: number format: double minimum: 0 maximum: 1 description: >- Ths validation progress expressed as a fraction of 1, e.g., 0.25 represents 25% of completion. status: $ref: '#/components/schemas/ValidationStatus' validation_results: type: array maxLength: 32 items: $ref: '#/components/schemas/ValidationResult' Visualizations: type: object additionalProperties: type: object description: >- The set of visualization configurations. It can be used for defining chart layouts and other visualization parameters. example: example_chart: tracks: - curves: null fill: - key: planned_wob label: L1 from: planned_min_wob to: planned_max_wob style: color: '#75CDFF' opacity: 0.5 pattern: solid palette: null - key: rotating_wob label: L2 from: rotating-tension-wob to: rotating_compression_wob style: color: '#EB8180' opacity: 0.5 pattern: solid palette: null heatmap: fillsOverlap: - fillsKeys: - planned_wob - rotating_wob label: L3 grid: null orientation: vertical indexDirection: direct indexTrack: null AgentDependency: type: object required: - name - version properties: name: type: string maxLength: 64 description: The name of the agent version: type: string maxLength: 64 description: The version of the agent pattern: ^(\d+).(\d+).(\d+)+$ SuggestionParameter: type: object properties: key: type: string description: Indicates a place in the Template nullable: true placeholder: type: string description: Shows what to display in the template nullable: true action_type: $ref: '#/components/schemas/ActionType' additionalProperties: false ActionType: enum: - ModifyDrillingFluidProgram - ModifyBHA - ModifyOperationParameter - ModifyRigSet - ModifyCasing - ModifyCasingString - ModifyTrajectory - ModifyPressureWindow - ModifyWBG - ModifyLiner - ModifyTieback - ModifyFormationTop type: string description: > Page to be opened for this action: * `ModifyDrillingFluidProgram` - Open drilling fluid program editor page * `ModifyBHA` - Open BHA editor page * `ModifyOperationParameter` - Open operation parameter editor page * `ModifyRigSet` - Open rig set editor page * `ModifyCasing` - Open wellbore geometry edit page * `ModifyCasingString` - Open casing design page * `ModifyTrajectory` - Open trajectory editor page * `ModifyPressureWindow` - open pressure window editor page * `ModifyWBG` - Open wellbore geometry editor page * `ModifyLiner` - Open liner editor page * `ModifyTieback` - Open tieback editor page * `ModifyFormationTop` - Open formation top editor page