Skip to content

D-WIS/DWISAdvisoryTemplate

Repository files navigation

DWIS Advisory Template

DWISAdvisoryTemplate is a starter solution for building DWIS-based advisory services. It provides:

  • a worker-hosted runtime process
  • semantic input and output contracts for DWIS blackboard integration
  • a shared-model generator for contextual OpenAPI schemas
  • a minimal end-to-end structure that can be extended into a real advisory application

The template is intentionally light on business logic and heavy on integration scaffolding. Its purpose is to give you a working shape for a DWIS advisor, not a finished advisory implementation.

Solution structure

The solution currently contains three projects:

  • DWIS.Advisor.Template.Model
    • semantic data contracts and worker configuration
  • DWIS.Advisor.Template.ModelSharedOut
    • OpenAPI schema merger and generated shared DTO model
  • DWIS.Advisor.Template.Server
    • executable worker service that runs the advisory loop

How the projects fit together

The runtime flow across the solution is:

  1. DWIS.Advisor.Template.ModelSharedOut merges local OpenAPI dependency schemas and generates shared DTO classes.
  2. DWIS.Advisor.Template.Model wraps those shared DTOs and defines semantic DWIS data contracts for realtime inputs, contextual inputs, and outputs.
  3. DWIS.Advisor.Template.Server hosts a worker that connects to the DWIS blackboard, reads those inputs, deserializes contextual payloads, runs advisory logic, and publishes outputs.

In short:

  • ModelSharedOut defines shared typed payloads
  • Model defines DWIS-facing contracts
  • Server runs the advisor

Current template behavior

Out of the box, the solution already includes:

  • worker configuration via ConfigurationTemplate
  • realtime input definitions for common drilling signals
  • contextual model definitions for:
    • trajectory
    • wellbore architecture
    • BHA or drillstring
  • a worker that:
    • connects to the blackboard
    • registers queries
    • reads realtime and contextual data
    • deserializes contextual JSON
    • exposes a placeholder block for processing
    • publishes outputs

What it does not include yet:

  • real advisory logic
  • populated output variables
  • deployment-specific DWIS connection configuration

That work is expected to be added by the consumer of the template.

Project details

DWIS.Advisor.Template.Model

This project contains the semantic contract layer for the advisor.

It defines:

  • ConfigurationTemplate
  • RealtimeInputsData
  • RealtimeOutputsData
  • TrajectoryData
  • WellBoreArchitectureData
  • BHADrillStringData

Those classes are built on top of DWIS.RigOS.Common.Worker and use attributes to define:

  • variable access mode
  • mandatory vs optional semantics
  • measurable quantity
  • physical location or dependency relationships

These attributes drive blackboard query and manifest generation.

Project README:

  • DWIS.Advisor.Template.Model/README.md

DWIS.Advisor.Template.ModelSharedOut

This project is a .NET console generator that reads OpenAPI files from:

  • DWIS.Advisor.Template.ModelSharedOut/json-schemas

and produces:

  • DWIS.Advisor.Template.ModelSharedOut/TemplateMergedModel.cs
  • DWIS.Advisor.Template.Service/wwwroot/json-schema/TemplateMergedModel.json

It normalizes schema names, rewrites schema references, and generates C# DTO and client types in the DWIS.Advisor.Template.ModelShared namespace.

Project README:

  • DWIS.Advisor.Template.ModelSharedOut/README.md

DWIS.Advisor.Template.Server

This project is the executable runtime host. It uses the generic .NET host and runs a Worker derived from DWISWorker<ConfigurationTemplate, object>.

The worker currently:

  • connects to the DWIS blackboard
  • registers queries for realtime and contextual inputs
  • registers outputs for publication
  • reads contextual and realtime data on each loop
  • deserializes JSON payloads into generated shared DTOs
  • exposes a placeholder section for advisory logic

Project README:

  • DWIS.Advisor.Template.Server/README.md

End-to-end development workflow

A typical workflow for adapting this template is:

  1. Add or update shared OpenAPI dependency schemas in DWIS.Advisor.Template.ModelSharedOut/json-schemas.
  2. Regenerate the shared model from DWIS.Advisor.Template.ModelSharedOut.
  3. Add or update semantic input and output contracts in DWIS.Advisor.Template.Model.
  4. Implement advisory logic in DWIS.Advisor.Template.Server/Worker.cs.
  5. Build and run the worker locally.
  6. Verify that:
    • queries resolve the expected blackboard variables
    • contextual payloads deserialize correctly
    • advisory outputs publish successfully

Running the solution

Build the full solution:

dotnet build .\DWIS.Advisor.Template.sln

Run the server:

dotnet run --project .\DWIS.Advisor.Template.Server\DWIS.Advisor.Template.Server.csproj

Regenerate the shared model:

dotnet run --project .\DWIS.Advisor.Template.ModelSharedOut\DWIS.Advisor.Template.ModelSharedOut.csproj

Where to make changes

Use this rule of thumb:

  • change ModelSharedOut when upstream schema dependencies change
  • change Model when the advisor needs different inputs, outputs, or configuration
  • change Server when the runtime behavior or advisory algorithm changes

If you are adding a new contextual JSON payload, you will usually touch all three projects.

Template extension points

The main extension points are:

  • adding new realtime inputs in RealtimeInputsData
  • adding new advisory outputs in RealtimeOutputsData
  • adding new contextual models backed by generated shared DTOs
  • implementing the actual decision logic in Worker.cs
  • adding deployment-appropriate configuration, logging, and validation

Notes and constraints

  • The shared model generator strips namespaces from schema names, so schema-name collisions are possible.
  • TemplateMergedModel.cs is generated code and should not be edited manually.
  • The server currently uses only basic logging configuration in appsettings.json.
  • The current worker loop contains placeholders and is intended to be extended.

License

This repository includes an MIT license:

  • LICENSE

Summary

This solution gives you the skeleton of a DWIS advisory service: shared schema generation, semantic contract definition, and a runnable worker host. To turn it into a production advisor, define your required data contracts, implement the advisory logic, and validate the runtime behavior against your DWIS environment.

About

A template for developing DWIS advisory systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages