Validate Config per Context Class 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.
With Mona's API, users can validate a specific context class instead of the entire configuration.

Users can leverage the /validate_config_per_context_class REST endpoint to validate a context class in their config without uploading it to the dashboard.

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

If a context class config is invalid, the response will inform you what is wrong with the config and what to change. If the context class 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_per_context_class' \
--header 'Authorization: Bearer {YOUR-ACCESS-TOKEN}'\
--header 'Content-Type: application/json' \
--data-raw '{
    "config": {YOUR-CONFIG},
    "context_class": {CONTEXT-CLASS-NAME}
}'
import requests
import json

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

payload = json.dumps({
  "config": {YOUR-CONFIG},
  "context_class": {CONTEXT-CLASS-NAME}
  })

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_per_context_class(config=<YOUR-CONFIG>,context_class=<CONTEXT-CLASS-NAME>)

Other possible parameters:

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

Example of successful response:

{
  "LOAN_APPLICATION_TUTORIAL": [
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "9312423tr23r"
        ]
      },
      "context": "c003ac45436htbi8of443e2c_test",
      "earliest_chained_@timestamp_seconds": 1669888576,
      "fields": {
        "TIME": 1637138870000,
        "approved_amount_banana": [
          false
        ],
        "feature_9": [
          500
        ]
      },
      "last_updated": 1674474797760,
      "normalized_hash": 0.5067615,
      "sample_config_name": null,
      "timestamp": 1637138870000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797760
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "c003ac4af45013db7aea0996b20e3e2c_test"
        ]
      },
      "context": "c003ac4af45013db7aea0996b20e3e2c_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611790869000,
        "approved_amount": [
          2123
        ],
        "approved_amount_banana": [
          true
        ],
        "city": [
          "Arizona_Chandler"
        ],
        "city_in_state": [
          "Arizona_Chandler_Arizona"
        ],
        "credit_label_delta": [
          0.6726153212606115
        ],
        "credit_score": [
          0.3273846787393885
        ],
        "feature_0": [
          2873150.8346222905
        ],
        "feature_1": [
          0.8458577716143697
        ],
        "feature_2": [
          325
        ],
        "feature_3": [
          13036
        ],
        "feature_4": [
          0.31966585256552105
        ],
        "feature_5": [
          0.8913529851348417
        ],
        "feature_6": [
          23
        ],
        "feature_7": [
          5.29156603536957
        ],
        "feature_8": [
          925.9330752387424
        ],
        "feature_9": [
          47.439550444112626
        ],
        "label": [
          true
        ],
        "loan_taken": [
          true
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "education"
        ],
        "offered_amount": [
          2123
        ],
        "offered_approved_delta": [
          0
        ],
        "offered_approved_delta_normalized": [
          0
        ],
        "purpose": [
          "Medical insurance"
        ],
        "return_until": [
          1613000469000
        ],
        "risk_lable_delta_abs": [
          0.6726153212606115
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Arizona"
        ]
      },
      "last_updated": 1674474797761,
      "normalized_hash": 0.4242126,
      "sample_config_name": null,
      "timestamp": 1611790869000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797761
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "a6747428b6202c8ad499dc7efa8d6492_test"
        ]
      },
      "context": "a6747428b6202c8ad499dc7efa8d6492_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611812777000,
        "approved_amount": [
          3918
        ],
        "approved_amount_banana": [
          true
        ],
        "city": [
          "Arizona_Mesa"
        ],
        "city_in_state": [
          "Arizona_Mesa_Arizona"
        ],
        "credit_label_delta": [
          0.8236116680786654
        ],
        "credit_score": [
          0.17638833192133468
        ],
        "feature_0": [
          2858404.9942383366
        ],
        "feature_1": [
          0.9272300821522235
        ],
        "feature_2": [
          422
        ],
        "feature_3": [
          3832
        ],
        "feature_4": [
          0.11052216576821974
        ],
        "feature_6": [
          27
        ],
        "feature_7": [
          1.035835109454637
        ],
        "label": [
          true
        ],
        "loan_taken": [
          true
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "retail"
        ],
        "offered_amount": [
          3918
        ],
        "offered_approved_delta": [
          0
        ],
        "offered_approved_delta_normalized": [
          0
        ],
        "purpose": [
          "Credit score improvement"
        ],
        "return_until": [
          1613022377000
        ],
        "risk_lable_delta_abs": [
          0.8236116680786654
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Arizona"
        ]
      },
      "last_updated": 1674474797763,
      "normalized_hash": 0.3249898,
      "sample_config_name": null,
      "timestamp": 1611812777000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797763
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "0a32d6ad08830fd74e4788cdace6346c_test"
        ]
      },
      "context": "0a32d6ad08830fd74e4788cdace6346c_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611816762000,
        "approved_amount_banana": [
          false
        ],
        "city": [
          "Arizona_Mesa"
        ],
        "city_in_state": [
          "Arizona_Mesa_Arizona"
        ],
        "credit_label_delta": [
          -0.08111785955777641
        ],
        "credit_score": [
          0.08111785955777641
        ],
        "feature_0": [
          2911405.5778428605
        ],
        "feature_1": [
          0.3758146872162626
        ],
        "feature_2": [
          546
        ],
        "feature_3": [
          6068
        ],
        "feature_4": [
          0.3056418519290583
        ],
        "feature_5": [
          0.5499036130349201
        ],
        "feature_6": [
          10
        ],
        "feature_7": [
          9.046385900649122
        ],
        "feature_8": [
          1064.2210730184472
        ],
        "feature_9": [
          16.435335159560207
        ],
        "label": [
          false
        ],
        "loan_taken": [
          false
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "foodservice"
        ],
        "offered_amount": [
          10410
        ],
        "purpose": [
          "Vacation costs"
        ],
        "risk_lable_delta_abs": [
          0.08111785955777641
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Arizona"
        ]
      },
      "last_updated": 1674474797765,
      "normalized_hash": 0.4141805,
      "sample_config_name": null,
      "timestamp": 1611816762000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797765
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "c6010ce2be440597db70595db2fca442_test"
        ]
      },
      "context": "c6010ce2be440597db70595db2fca442_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611793655000,
        "approved_amount_banana": [
          false
        ],
        "city": [
          "Arizona_Phoenix"
        ],
        "city_in_state": [
          "Arizona_Phoenix_Arizona"
        ],
        "credit_label_delta": [
          -0.4562267848207529
        ],
        "credit_score": [
          0.4562267848207529
        ],
        "feature_0": [
          2745550.616456258
        ],
        "feature_1": [
          4.532509441738182
        ],
        "feature_2": [
          380
        ],
        "feature_3": [
          20
        ],
        "feature_5": [
          0.5937784432508102
        ],
        "feature_6": [
          180
        ],
        "feature_8": [
          933.6181136785158
        ],
        "feature_9": [
          25.49605452022623
        ],
        "label": [
          false
        ],
        "loan_taken": [
          false
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "manufacturing"
        ],
        "offered_amount": [
          2650
        ],
        "purpose": [
          "Credit score improvement"
        ],
        "risk_lable_delta_abs": [
          0.4562267848207529
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Arizona"
        ]
      },
      "last_updated": 1674474797767,
      "normalized_hash": 0.2898221,
      "sample_config_name": null,
      "timestamp": 1611793655000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797767
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "2698b2e999cdf97a6f60f9bfcaae0bba_test"
        ]
      },
      "context": "2698b2e999cdf97a6f60f9bfcaae0bba_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611802639000,
        "approved_amount": [
          16855
        ],
        "approved_amount_banana": [
          true
        ],
        "city": [
          "Maryland_Frederick"
        ],
        "city_in_state": [
          "Maryland_Frederick_Maryland"
        ],
        "credit_label_delta": [
          -0.11792151024474949
        ],
        "credit_score": [
          0.11792151024474949
        ],
        "feature_0": [
          2655335.842104896
        ],
        "feature_1": [
          0.9087846579024331
        ],
        "feature_2": [
          616
        ],
        "feature_3": [
          19537
        ],
        "feature_4": [
          0.2458865394319878
        ],
        "feature_6": [
          26
        ],
        "feature_7": [
          1.1493871551636363
        ],
        "label": [
          false
        ],
        "loan_taken": [
          true
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "no category"
        ],
        "offered_amount": [
          16855
        ],
        "offered_approved_delta": [
          0
        ],
        "offered_approved_delta_normalized": [
          0
        ],
        "purpose": [
          "House renovation"
        ],
        "return_until": [
          1613012239000
        ],
        "risk_lable_delta_abs": [
          0.11792151024474949
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Maryland"
        ]
      },
      "last_updated": 1674474797769,
      "normalized_hash": 0.3759118,
      "sample_config_name": null,
      "timestamp": 1611802639000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797768
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "d70eaaa571166fa6a78be104d6ae3d40_test"
        ]
      },
      "context": "d70eaaa571166fa6a78be104d6ae3d40_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611786389000,
        "approved_amount": [
          2922
        ],
        "approved_amount_banana": [
          true
        ],
        "city": [
          "Kansas_Overland Park"
        ],
        "city_in_state": [
          "Kansas_Overland Park_Kansas"
        ],
        "credit_label_delta": [
          0.9871047391963658
        ],
        "credit_score": [
          0.0128952608036342
        ],
        "feature_0": [
          3001307.860509545
        ],
        "feature_1": [
          0.8445019922219098
        ],
        "feature_2": [
          320
        ],
        "feature_3": [
          12223
        ],
        "feature_4": [
          0.2674592900220434
        ],
        "feature_5": [
          0.7988482057262806
        ],
        "feature_6": [
          16
        ],
        "feature_7": [
          2.6663601306645948
        ],
        "feature_8": [
          1057.5796283067316
        ],
        "feature_9": [
          80.55856145573591
        ],
        "label": [
          true
        ],
        "loan_taken": [
          true
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "no category"
        ],
        "offered_amount": [
          10962
        ],
        "offered_approved_delta": [
          8040
        ],
        "offered_approved_delta_normalized": [
          0.7334428024083196
        ],
        "purpose": [
          "Home construction"
        ],
        "return_until": [
          1612995989000
        ],
        "risk_lable_delta_abs": [
          0.9871047391963658
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Kansas"
        ]
      },
      "last_updated": 1674474797771,
      "normalized_hash": 0.7764893,
      "sample_config_name": null,
      "timestamp": 1611786389000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797770
    },
    {
      "arc_class": "LOAN_APPLICATION_TUTORIAL",
      "arc_class_contexts": {
        "LOAN_APPLICATION_TUTORIAL": [
          "ed231938be192c8b8dee356945397514_test"
        ]
      },
      "context": "ed231938be192c8b8dee356945397514_test",
      "earliest_chained_@timestamp_seconds": 1636901849,
      "fields": {
        "TIME": 1611793588000,
        "approved_amount": [
          8498
        ],
        "approved_amount_banana": [
          true
        ],
        "city": [
          "Georgia_Augusta"
        ],
        "city_in_state": [
          "Georgia_Augusta_Georgia"
        ],
        "credit_label_delta": [
          -0.2712414030866602
        ],
        "credit_score": [
          0.2712414030866602
        ],
        "feature_0": [
          2308138.9739531004
        ],
        "feature_1": [
          1.5563113791716328
        ],
        "feature_2": [
          1133
        ],
        "feature_3": [
          6862
        ],
        "feature_4": [
          0
        ],
        "feature_5": [
          1.1571773132100118
        ],
        "feature_6": [
          12
        ],
        "feature_7": [
          3.58462580684442
        ],
        "feature_8": [
          1918.8852225396993
        ],
        "feature_9": [
          1.9629712098656236
        ],
        "label": [
          false
        ],
        "loan_taken": [
          true
        ],
        "model_version": [
          "v1"
        ],
        "occupation": [
          "education"
        ],
        "offered_amount": [
          8498
        ],
        "offered_approved_delta": [
          0
        ],
        "offered_approved_delta_normalized": [
          0
        ],
        "purpose": [
          "Medical insurance"
        ],
        "return_until": [
          1613003188000
        ],
        "risk_lable_delta_abs": [
          0.2712414030866602
        ],
        "stage": [
          "test"
        ],
        "state": [
          "Georgia"
        ]
      },
      "last_updated": 1674474797801,
      "normalized_hash": 0.2087177,
      "sample_config_name": null,
      "timestamp": 1611793588000,
      "user_id": "62465b54-453-78df-g3v3-54y7he4",
      "version_timestamp": 1674474797801
    }
  ]
}