TheTechIdea OilGas - Developer guide User guide →

Data sources & mapping

Every mapping is a contract with a JSON-backed default implementation. Resolution order: explicit argument, then the data source's mapping, then the environment's files, then built-in defaults. A missing file is a warning, never a failure.

Mapping profiles (tables to the canonical model)

A profile maps a source's tables and columns to canonical entities (well, string, component, interval, top, survey, holeSection...), with units per field, default units, per-field code maps (codes) and optional attribute tables. Built-in profiles: csv (complete), ppdm39 (starter - verify column names against your schema), template.

MappingProfile.Load(name) first looks for <name>.profile.json in the environment's resources.mappingProfilesFolder, so each customer can ship its own PPDM or database flavour.

Code vocabularies (ICodeVocabulary)

Source codes to canonical codes per domain: componentType, stringKind, itemStatus, intervalType, contactType, lithology, curveMnemonic, barrierElementType. Lookup order for a coded field: the profile's per-field codes, the profile's vocabulary / vocabularyFiles, the environment's resources.vocabularyFiles, then the raw value. Unmapped enum codes are reported as warnings, never guessed.

{
  "name": "PPDM-style source codes (sample - replace with your data model's code lists)",
  "domains": {
    "componentType": {
      "PKR": "PACKER_PERMANENT", "PKR-PERM": "PACKER_PERMANENT", "PKR-RET": "PACKER_RETRIEVABLE", "PKR-HYD": "PACKER_HYDRAULIC",
      "SSSV": "SSSV_TUBING_RETRIEVABLE", "TRSV": "SSSV_TUBING_RETRIEVABLE", "WRSV": "SSSV_WIRELINE_RETRIEVABLE",
      "NIP": "NIPPLE_LANDING", "NIP-NOGO": "NIPPLE_NOGO", "GLM": "GAS_LIFT_MANDREL", "SSD": "SLIDING_SLEEVE", "WEG": "WIRELINE_ENTRY_GUIDE",
      "LNR-HGR": "LINER_HANGER", "LTP": "LINER_TOP_PACKER", "FS": "FLOAT_SHOE", "FC": "FLOAT_COLLAR", "BP": "BRIDGE_PLUG", "CR": "CEMENT_RETAINER",
      "THS": "WELLHEAD_TUBING_HEAD", "CHH": "WELLHEAD_CASING_HEAD", "TREE": "XMAS_TREE", "HGR": "TUBING_HANGER"
    },
    "stringKind": { "COND": "Conductor", "SURF CSG": "Surface", "INT CSG": "Intermediate", "PROD CSG": "Production", "LNR": "Liner", "TBG": "Tubing", "CT": "CoiledTubing" },
    "itemStatus": { "ACTIVE": "Installed", "IN HOLE": "Installed", "PULLED": "Removed", "P&A": "Abandoned", "PROPOSED": "Planned" },
    "intervalType": { "PERF": "PERFORATION", "OPEN HOLE": "OPEN_HOLE" },
    "contactType": { "OIL WATER CONTACT": "OWC", "GAS OIL CONTACT": "GOC", "GAS WATER CONTACT": "GWC", "FREE WATER LEVEL": "FWL" },
    "lithology": { "SH": "shale", "SS": "sandstone", "LS": "limestone", "DOL": "dolomite", "ANHY": "anhydrite", "CLST": "claystone" },
    "curveMnemonic": { "GAM": "GR", "GRC": "GR", "GR_EDTC": "GR", "RDEP": "RT", "RMED": "RES", "DEN": "RHOB", "NEU": "NPHI", "DTC": "DT" }
  }
}

Stratigraphic lexicons (IStratigraphicLexicon)

Layer names differ between companies and countries. A lexicon maps ids, names, aliases and local names to one canonical unit; prefixes such as "Top " are ignored when resolving. Loaders set FormationTop.UnitId and keep the source name; views show the unit's name for the environment's culture; correlation lines, flattening, cross-section surfaces and duplicate-pick checks match tops by unit.

{
 "name": "NCS lithostratigraphy (sample): official unit names of the Norwegian lithostratigraphic chart (Sodir FactPages; NPD Bulletins 3 and 5). Chart parents only where the age was checked on the FactPages: Hugin (Early Bathonian-Early Oxfordian), Heather (Bathonian-Kimmeridgian), Sleipner (Bajocian-Bathonian).",
 "stripPrefixes": [
  "Top ",
  "Base ",
  "TOP ",
  "BASE "
 ],
 "units": [
  {
   "id": "NORDLAND",
   "name": "Nordland Group",
   "aliases": [
    "NORDLAND GP",
    "Nordland Gp."
   ],
   "localNames": {
    "nb-NO": "Nordlandgruppen"
   },
   "lithology": "claystone",
   "rank": "Group"
  },
  {
   "id": "HORDALAND",
   "name": "Hordaland Group",
   "aliases": [
    "HORDALAND GP"
   ],
   "localNames": {
    "nb-NO": "Hordalandgruppen"
   },
   "lithology": "claystone",
   "rank": "Group"
  },
  {
   "id": "BALDER",
   "name": "Balder Formation",
   "aliases": [
    "BALDER FM",
    "Balder Fm."
   ],
   "localNames": {
    "nb-NO": "Balderformasjonen"
   },
   "lithology": "shale",
   "rank": "Formation"
  },
  {
   "id": "LISTA",
   "name": "Lista Formation",
   "aliases": [
    "LISTA FM"
   ],
   "localNames": {
    "nb-NO": "Listaformasjonen"
   },
   "lithology": "shale",
   "rank": "Formation"
  },
  {
   "id": "SHETLAND",
   "name": "Shetland Group",
   "aliases": [
    "SHETLAND GP"
   ],
   "localNames": {
    "nb-NO": "Shetlandgruppen"
   },
   "lithology": "chalk",
   "rank": "Group"
  },
  {
   "id": "DRAUPNE",
   "name": "Draupne Formation",
   "aliases": [
    "DRAUPNE FM",
    "Draupne Fm."
   ],
   "localNames": {
    "nb-NO": "Draupneformasjonen"
   },
   "lithology": "shale",
   "color": "#5b4a3a",
   "rank": "Formation"
  },
  {
   "id": "HEATHER",
   "name": "Heather Formation",
   "aliases": [
    "HEATHER FM"
   ],
   "localNames": {
    "nb-NO": "Heatherformasjonen"
   },
   "lithology": "shale",
   "rank": "Formation",
   "parent": "Jurassic"
  },
  {
   "id": "HUGIN",
   "name": "Hugin Formation",
   "aliases": [
    "HUGIN FM",
    "Hugin Fm."
   ],
   "localNames": {
    "nb-NO": "Huginformasjonen"
   },
   "lithology": "sandstone",
   "color": "#c8a000",
   "rank": "Formation",
   "parent": "Jurassic"
  },
  {
   "id": "SLEIPNER",
   "name": "Sleipner Formation",
   "aliases": [
    "SLEIPNER FM"
   ],
   "localNames": {
    "nb-NO": "Sleipnerformasjonen"
   },
   "lithology": "sandstone",
   "rank": "Formation",
   "parent": "MiddleJurassic"
  },
  {
   "id": "SKAGERRAK",
   "name": "Skagerrak Formation",
   "aliases": [
    "SKAGERRAK FM"
   ],
   "localNames": {
    "nb-NO": "Skagerrakformasjonen"
   },
   "lithology": "sandstone",
   "rank": "Formation"
  },
  {
   "id": "ZECHSTEIN",
   "name": "Zechstein Group",
   "aliases": [
    "ZECHSTEIN GP"
   ],
   "localNames": {
    "nb-NO": "Zechsteingruppen"
   },
   "lithology": "salt",
   "rank": "Group"
  }
 ]
}

Symbols, curve families, labels

Writing data back out

Every format the loaders read can be written again. The CSV writer uses the same mapping profile in reverse, so a customer's layout (tables, columns, units, codes) is written in that layout. Read -> write -> read loses nothing the format supports.

// Write the canonical model back out: CSV through a mapping profile (any layout), LAS 2.0 / 3.0, WITSML 1.4.1.1.
TabularWriter.WriteCsvFolder(model, folder, MappingProfile.Load("csv"));                // the reverse of MappedWellDataProvider
string las = LasWriter.Write(model, options: new LasWriteOptions { Version = "3.0" });
string trajectory = WitsmlWriter.Trajectory(model);
string markers = WitsmlWriter.FormationMarkers(model);
string logs = WitsmlWriter.Logs(model);

A complete environment

{
  // Kuwait (sample) - feet, Arabic display names for formations, PPDM-style source codes
  "name": "Kuwait (sample)",
  "culture": "ar-KW",
  "units": { "depthUnit": "ft", "pressureUnit": "psi" },
  "printing": { "paper": "A3", "headerFields": { "Country": "Kuwait" } },
  "resources": {
    "vocabularyFiles": [ "ppdm-codes.vocabulary.sample.json" ],
    "lexiconFiles": [ "kuwait.lexicon.sample.json" ],
    "mappingProfilesFolder": "profiles"
  }
}