Validate Config via REST API

When uploading a configuration to Mona, the config file goes through a validation process that checks if the config is written in the correct syntax, has no fields in verses that are not defined in the fields, and more.

Users can leverage the /validate_config REST endpoint to validate their config without uploading it to the dashboard.

In order to validate the config, first of all, users must have an authorization token for their account.
More info on generating a token here.

If a config is invalid, the response will inform you what is wrong with the config and what to change. If the config is valid, the response will be a sample of values for your fields configuration.

curl --location --request POST 'https://api{YOUR-USER-ID}.monalabs.io/validate_config' \
--header 'Authorization: Bearer {YOUR-ACCESS-TOKEN}'\
--header 'Content-Type: application/json' \
--data-raw '{
    "config": {YOUR-CONFIG},
    "latest_amount": 4
}'
import requests
import json

url = "https://api{YOUR-USER-ID}.monalabs.io/validate_config"

payload = json.dumps({
  "config": {YOUR-CONFIG}
  })

headers = {
  'Authorization': 'Bearer {YOUR-ACCESS-TOKEN}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
from mona_sdk.client import Client

api_key = <YOUR-API-KEY>
secret = <YOUR-SECRET>

my_mona_client = Client(api_key, secret)

my_mona_client.validate_config(config=<YOUR-CONFIG>,latest_amount=4)

Other possible parameters:

  • list_of_context_ids : A list of context ids to check the config with.
  • latest_amount: The number of contexts that Mona will validate the config against. This will give you a number of data contexts with values to your configuration.

Example of a successful response:

{
  "response_data": {
    "field_building_results": {
      "LOAN_APPLICATION_TUTORIAL": [
        {
          "context": "ddfdasqewedf",
          "user_id": "52463-0245773-464a65-6422-766wg34gg3",
          "arc_class": "LOAN_APPLICATION_TUTORIAL",
          "timestamp": 1623327443000,
          "last_updated": 1631621009550,
          "fields": {
            "occupation": [
              "technology"
            ],
            "city": [
              "Wilmington"
            ],
            "state": [
              "Delaware"
            ],
            "purpose": [
              "Home construction"
            ],
            "loan_taken": [
              true
            ],
            "return_until": [
              1613051286000
            ],
            "offered_amount": [
              2015
            ],
            "approved_amount": [
              2015
            ],
            "feature_0": [
              3104896.3153618653
            ],
            "feature_1": [
              1.104984432304057
            ],
            "feature_2": [
              508
            ],
            "feature_3": [
              6951
            ],
            "feature_4": [
              0
            ],
            "feature_5": [
              0.8602221277358572
            ],
            "feature_6": [
              127
            ],
            "feature_7": [
              0
            ],
            "feature_8": [
              1170.0884644821508
            ],
            "stage": [
              "test"
            ],
            "model_version": [
              "v1"
            ],
            "TIME": 1623327443000
          },
          "version_timestamp": 1631621009549,
          "arc_class_contexts": {
            "LOAN_APPLICATION_TUTORIAL": [
              "ddfdasqewedf"
            ]
          },
          "normalized_hash": 0.3252505
        },
        {
          "context": "asasssfdsfa",
          "user_id": "84fbc309-0773-4a65-ab08-61fac32de3e3",
          "arc_class": "LOAN_APPLICATION_TUTORIAL",
          "timestamp": 1623326314000,
          "last_updated": 1631621009554,
          "fields": {
            "occupation": [
              "education"
            ],
            "city": [
              "Phoenix"
            ],
            "state": [
              "Arizona"
            ],
            "purpose": [
              "Home services"
            ],
            "loan_taken": [
              true
            ],
            "return_until": [
              1613052038000
            ],
            "offered_amount": [
              17597
            ],
            "feature_0": [
              2816812.026366597
            ],
            "feature_1": [
              0.5520508993135393
            ],
            "feature_2": [
              601
            ],
            "feature_3": [
              12003
            ],
            "feature_4": [
              0.02760948701383037
            ],
            "feature_6": [
              7
            ],
            "feature_7": [
              8.160327989686898
            ],
            "stage": [
              "test"
            ],
            "model_version": [
              "v1"
            ],
            "TIME": 1623326314000
          },
          "version_timestamp": 1631621009554,
          "arc_class_contexts": {
            "LOAN_APPLICATION_TUTORIAL": [
              "asasssfdsfa"
            ]
          },
          "normalized_hash": 0.9158756
        },
        {
          "context": "some_oewfatasher_vdspost_id",
          "user_id": "84fbc309-0773-4a65-ab08-61fac32de3e3",
          "arc_class": "LOAN_APPLICATION_TUTORIAL",
          "timestamp": 1623327443000,
          "last_updated": 1631621009556,
          "fields": {
            "TIME": 1623327443000
          },
          "version_timestamp": 1631621009556,
          "arc_class_contexts": {
            "LOAN_APPLICATION_TUTORIAL": [
              "some_oewfatasher_vdspost_id"
            ]
          },
          "normalized_hash": 0.3721717
        },
        {
          "context": "ddffewasddf",
          "user_id": "84fbc309-0773-4a65-ab08-61fac32de3e3",
          "arc_class": "LOAN_APPLICATION_TUTORIAL",
          "timestamp": 1623327443000,
          "last_updated": 1631621009558,
          "fields": {
            "occupation": [
              "technology"
            ],
            "city": [
              "Wilmington"
            ],
            "state": [
              "Delaware"
            ],
            "purpose": [
              "Home construction"
            ],
            "loan_taken": [
              true
            ],
            "return_until": [
              1613051286000
            ],
            "offered_amount": [
              2015
            ],
            "approved_amount": [
              2015
            ],
            "feature_0": [
              3104896.3153618653
            ],
            "feature_1": [
              1.104984432304057
            ],
            "feature_2": [
              508
            ],
            "feature_3": [
              6951
            ],
            "feature_4": [
              0
            ],
            "feature_5": [
              0.8602221277358572
            ],
            "feature_6": [
              127
            ],
            "feature_7": [
              0
            ],
            "feature_8": [
              1170.0884644821508
            ],
            "stage": [
              "test"
            ],
            "model_version": [
              "v1"
            ],
            "TIME": 1623327443000
          },
          "version_timestamp": 1631621009557,
          "arc_class_contexts": {
            "LOAN_APPLICATION_TUTORIAL": [
              "ddffewasddf"
            ]
          },
          "normalized_hash": 0.7750459
        }
      ]
    }
  },
  "partial_data": false
}

Example of an unsuccessful response:

{
    "response_data": {
        "issues": {
            "84fbc309-0773-4a65-ab08-61fac32de3e3": {
                "LOAN_APPLICATION_TUTORIAL": {
                    "fields": {
                        "risk score": [
                            "field name \"credit score\" must not contain either: a space"
                        ]
                    }
                }
            }
        }
    },
    "partial_data": false
}