nDigits

nDigits #

nDigits is an optional request parameter, which should indicate the expected number of digits that the displays should contain, if this happens to be known beforehand. Providing this parameter might result in more accurate readings by Blicker. In addition, it can be used to verify that the readings by Blicker are in line with the expectations.

For most analog and digital meters, this is a fixed number. If the meter contains multiple displays, it is assumed that all have the same number of digits. If the number of digits is not known, or the above two assumptions do not hold, we advise not to use the nDigits request parameter.

As an example, the following test image has 5 digits. All digits before the decimal separator are included, even if they would contain the digit “0” (zero). Digits after the decimal separator are not included.

If Blicker is able to verify that the expected number of digits is indeed found, no special message is returned. For example, when the expected number of digits was 5, the response will contain:

{
    "expectedNDigits": 5
}

When the number of digits could not be verified, the response will contain messageCode no_match_expected_n_digits. For example:

{
    "expectedNDigits": 4,
    "messages": [
        {
            "code": "no_match_expected_n_digits",
            "message": "The number of detected digits on this display does not match the expected number.",
            "messageId": "<messageId",
            "objectId": "<objectId>"
        }
    ]
}

When the number of detected digits differs from the number of expected digits, it is a sign that something may have gone wrong, and that the particular request later needs to be manually checked in the Blicker portal.

Example request #

curl -X 'POST' \
  'https://api.blicker.ai/blicker/2020-10-01' \
  -H 'subscription-key: <your subscription key>' \
  -F 'image=@test_image.jpg' \
  -F 'nDigits=5'
from pathlib import Path
from pprint import pprint

import requests

response = requests.post(
    "https://api.blicker.ai/blicker/2020-10-01",
    headers={"subscription-key": "<your subscription key>"},
    files={"image": ("test_image.jpg", Path("test_image.jpg").read_bytes())},
    data={"nDigits": 5},
)

pprint(response.json())