Petro.ai CLI


The Petro.ai Command Line Interface is the access point for organizations to run jobs on the Petro.ai Engine. The Petro.ai CLI Toolset is a growing set of tools that allow organizations to interface with the Petro.ai engine. 


Jobs are organized into Job Families, each with similar functionality related to a data type or function. To run a job, the command line interface is passed arguments, including a JSON object (as a file or as a string) that contains all the necessary arguments for that particular job family.


The code snippet below is an exhaustive list of options for the Petro.ai CLI:


// to access the help, use the below command
rai.petro.commandline (-h | --help)

// to list available jobs, use the below command
rai.petro.commandline (--list-jobs)

// to run or create jobs, use the below command
rai.petro.commandline ([--create-job <--job-file | job-data>] | [--run-job <--job-file | job-data>]) (--repo=MONGODB) [--v]




ARIES Job Family

The ARIES Job Family manages input and output of ARIES wells, production, and declines to Petro.ai. 


Name
Type
Default
Required/Optional
Description
jobName
string
null
Required
Name of the Job: loadAries or writeAries.
connectionString
string
null
Required
Connection string to the source database.
provider
string
null
Required
Provider for the connection string. Accepted values: SQLServer, ODBC, OleDB.
load
boolean
false
Either load or write option is required
Load from the provided source to Petro.ai.
write
boolean
false
Either load or write option is required
Write to the provided source from Petro.ai.
wells
boolean
false
Either wells, wellDeclineCurves, or both options are required
Operate on wells.
wellDeclineCurves
boolean
false
Either wells, wellDeclineCurves, or both options are required
Operate on well declines.
schema
string
null
Optional
Schema name for the database.
official
boolean
false
Optional
Provide flag to make well declines official when loading to Petro.ai.
overwritebooleanfalseOptionalProvide flag to overwrite data when writing from Petro.ai to enterprise databases.
scenariostringnullEither scenario or qualifier argument is required (not both)Specifies a scenario to query from ARIES.
qualifierlist of stringsnullEither scenario or qualifier argument is required (not both)
Specifies a qualifier or qualifiers to query from ARIES. To load all qualifiers, use 'qualifier': ['$all']
dbConfigPathstringnullOptionalPath to the database configuration file. This is a json file as defined below that allows for multiple database configurations (schema names, table names, and column header names). If this option is not used, defaults will be put in place - these defaults are the same as the example config templates below. 



Example Load ARIES Job

CLI

rai.petro.commandline --run-job --job-file="C:\Users\username\jobs\loadAries.json" --repo="mongodb://localhost"

loadAries.json

{
  'jobName': 'loadAries',
  'connectionString': 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/name/aries.accdb;Persist Security Info=False;',
  'provider': 'OleDB',
  'load': true,
  'write': false,
  'wells': false,
  'wellDeclineCurves': true,
  'schema': null,
  'official': false,
  'overwrite': false,
  'scenario': 'test',
  'dbConfigPath': 'C:/Users/name/AriesConfig.json'
}

AriesConfig.json (This is also the default configuration if the dbConfigPath is left empty)

{
  "AC_ECONOMIC": {
    "name": "AC_ECONOMIC",
    "columns": {
      "propnum": "PROPNUM",
      "section": "SECTION",
      "sequence": "SEQUENCE",
      "qualifier": "QUALIFIER",
      "keyword": "KEYWORD",
      "expression": "EXPRESSION"
    }
  },
  "AC_PROPERTY": {
    "name": "AC_PROPERTY",
    "columns": {
      "lease": "LEASE",
      "operatorName": "OPERATOR",
      "firstProd": "FIRST_PROD",
      "measuredDepth": "DEPTH"
    }
  },
  "AC_PRODUCT": {
    "name": "AC_PRODUCT",
    "columns": {
      "propnum": "PROPNUM"
    }
  },
  "AC_SCENARIO": {
    "name": "AC_SCENARIO",
    "columns": {
      "scenario": "SCEN_NAME",
      "section": "DATA_SECT"
    }
  },
  "schema": ""
}


If a user has an ARIES instance with the AC_PROPERTY table named 'AC_MASTER' and the AC_ECONOMIC table's section column named 'SECT', the configuration file would look like this:

{
  "AC_ECONOMIC": {
    "name": "AC_ECONOMIC",
    "columns": {
      "propnum": "PROPNUM",
      "section": "SECT",
      "sequence": "SEQUENCE",
      "qualifier": "QUALIFIER",
      "keyword": "KEYWORD",
      "expression": "EXPRESSION"
    }
  },
  "AC_PROPERTY": {
    "name": "AC_MASTER",
    "columns": {
      "lease": "Lease",
      "operatorName": "Operator",
      "firstProd": "First_PROD",
      "measuredDepth": "DEPTH"
    }
  },
  "AC_PRODUCT": {
    "name": "AC_PRODUCT",
    "columns": {
      "propnum": "PROPNUM"
    }
  },
  "AC_SCENARIO": {
    "name": "AC_SCENARIO",
    "columns": {
      "scenario": "SCEN_NAME",
      "section": "DATA_SECT"
    }
  },
  "schema": ""
}



Example Write ARIES Job

CLI

rai.petro.commandline --run-job --job-file="C:\Users\username\jobs\writeAries.json" --repo="mongodb://localhost"

writeAries.json

{
  'jobName': 'writeAries',
  'connectionString': 'connectionString',
  'provider': 'OleDB',
  'load': false,
  'write': true,
  'wells': false,
  'wellDeclineCurves': true,
  'schema': null,
  'official': false,
  'overwrite': false,
  'qualifier': ['test', 'anotherTest']
  'dbConfigPath': null,
}




SQL Job Family

The SQL Job Family manages input of well and production data from an SQL database to Petro.ai. 


NameTypeDefaultRequired/OptionalDescription
jobName
string
nullRequiredName of the Job: loadSQL.
connectionString
string
nullRequired
Connection string to the source database.
provider
string
nullRequired
Provider for the connection string. Accepted values: SQLServer, ODBC, OleDB.
wellsbooleanfalseRequiredOperate on wells.
schemastringnullOptionalSchema name for the database.
wellTableNamestringnullRequiredTable name for the well table.
prodTableNamestringnullRequiredTable name for the production table.
officialbooleanfalseOptionalProvide flag to make well declines official when loading to Petro.ai.
dbConfigPathstringnullOptionalPath to the database configuration file. This is a json file as defined below that allows for multiple database configurations (schema names, table names, and column header names). If this option is not used, defaults will be put in place - these defaults are the same as the example config templates below.


Example Load SQL Job

CLI

rai.petro.commandline --run-job --job-file="C:\Users\username\jobs\loadSQL.json" --repo="mongodb://localhost"

loadSQL.json

{
  'jobName': 'loadSQL',
  'connectionString': 'Driver={SQL Server};Server=\\serverName;Database=dbName;Trusted_Connection=Yes;',
  'provider': 'ODBC',
  'wells': true,
  'schema': null,
  'wellTableName': 'wells',
  'prodTableName': 'production',
  'official': false,
  'dbConfigPath': 'C:/Users/name/sqlConfig.json'
}

sqlConfig.json (This is also the default configuration if the dbConfigPath is left empty)

{
  "WELLS": {
    "name": "WELLS",
    "columns": {
      "api": "API",
      "uwi": "UWI",
      "name": "WellName",
      "operatorName": "CurrentOperatorName",
      "classInitialName": "ClassInitialName",
      "classFinalName": "ClassFinalName",
      "statusFinal": "StatusFinal",
      "statusCurrent": "StatusProductionCurrentCode",
      "productsObjectiveCode": "ProductsObjectiveCode",
      "permitDate": "PermitDate",
      "permitExpiryDate": "PermitExpiryDate",
      "rigOnSiteDate": "RigOnSiteDate",
      "spudDate": "SpudDate",
      "completionDate": "CompletionDate",
      "completionReportDate": "CompletionReportDate",
      "finalDrillingDate": "FinalDrillingDate",
      "rigReleaseDate": "RigReleaseDate",
      "drillAbandonmentDate": "DrillAbandonmentDate",
      "suspendedDate": "SuspendedDate",
      "abandonmentDate": "AbandonmentDate",
      "firstProductionDate": "OnProductionDate",
      "originalOperatorName": "OriginalOperatorName",
      "drillingContractorName": "DrillingContractorName",
      "drillingRigNumber": "DrillingRigNumber",
      "drillingToolsCode": "DrillingToolsCode",
      "permitNumber": "PermitNumber",
      "permitFilerName": "PermitFilerName",
      "leaseDesignationName": "LeaseDesignationName",
      "wellNumber": "WellNumber",
      "wellDesignationName": "WellDesignationName",
      "regionName": "RegionName",
      "playType": "PlayType",
      "playName": "PlayName",
      "fieldName": "FieldName",
      "basinName": "BasinName",
      "subBasinName": "SubBasinName",
      "elevationAtGround": "ElevationAtGround",
      "holeDirectionName": "HoleDirectionName",
      "totalObjectiveDepth": "TotalObjectiveDepthTVD",
      "totalDepth": "TotalDepthTVD",
      "measuredDepth": "MeasuredDepth",
      "plugbackDepth": "PlugbackDepth",
      "waterDepth": "WaterDepth",
      "whipstockDepth": "WhipstockDepth",
      "formationObjectiveName": "FormationObjectiveName",
      "formationBottomHoleName": "FormationObjectiveBottomHoleName",
      "ageOldestPenetratedName": "AgeOldestPenetratedName",
      "ageBottomHoleName": "AgeBottomHoleName",
      "parentWellUwi": "ParentWellUWI",
      "parentWellRelationshipCode": "ParentWellRelationshipCode",
      "countryName": "CountryName",
      "stateName": "StateName",
      "stateCode": "StateCode",
      "countyName": "CountyName",
      "countyCode": "CountyCode",
      "districtName": "DistrictName",
      "datumCode": "DatumCode",
      "surfaceLat": "Lat",
      "surfaceLon": "Lon",
      "midPointLat": "MidPointLat",
      "midPointLon": "MidPointLon",
      "bottomHoleLat": "BottomHoleLat",
      "bottomHoleLon": "BottomHoleLon",
      "geographicCoordinateProvider": "GeographicCoordinateProvider",
      "geographicCoordinateQuality": "GeographicCoordinateQuality",
      "casingMinSize": "CasingMinSize",
      "casingMinSizeUnits": "CasingMinSizeUnits",
      "coreSamplesConv": "CoreSamplesConv",
      "coreSamplesSidewall": "CoreSamplesSidewall",
      "fracFocusLatestJobDate": "FracFocusLatestJobDate"
    }
  },
  "PRODUCTION": {
    "name": "PRODUCTION",
    "columns": {
      "api": "API",
      "year": "Year",
      "month": "Month",
      "date": "Date",
      "oil": "Oil",
      "gas": "Gas",
      "water": "Water"
    }
  },
  "schema": "dbo"
}



LAS File Job Family

The LAS File Job Family manages input of *.las files to Petro.ai. 


NameTypeDefaultRequired/OptionalDescription
jobNamestringnullRequiredName of the Job: loadLasFile or loadLasFolder.
fileUristringnullRequired for loadLasFile onlyURI to the *.las file. May be any valid URI.
folderstringnullRequired for loadLasFolderURI to the root folder of *.las files.
recursivebooleanfalseOptional for loadLasFolderFlag to identify recursive search in folders or to keep load at root level.


Example Load LAS File Job

CLI

rai.petro.commandline --run-job --job-file="C:\Users\username\jobs\loadLASFile.json" --repo="mongodb://localhost"

loadLASFile.json

{
  'jobName': 'loadLasFile',
  'fileUri': 'file://path/to/file.las'
}


Example Load LAS Folder Job

CLI

rai.petro.commandline --run-job --job-file="C:\Users\username\jobs\loadLASFolder.json" --repo="mongodb://localhost"

loadLASFolder.json

{
  'jobName': 'loadLasFolder',
  'folder': 'path/to/folder',
  'recursive': false
}