Skip to content

Dynamic Validation

apurvabisht97 edited this page Jun 21, 2022 · 5 revisions

Saral App supports dynamic validation feature. As this application will be used by different states , this feature will avoid maintaining different frontend source code to customise valdation.

Dynamic validation will come from backend with regular expression, and dynamic validation is used at cell level if validation is not available at cell level then in that case result validation will be used which is used as global result validation and it will also come from backend.

1. Result validation(This is global result validation irrespective of cell level)

{
    "resultValidation": {
        "validate": {
            "regExp": "[0-1]",
            "errorMsg": "Omr result should be 1 or 0"
        }
    }
}

2. Cell level validation

 {
    "validate": {
        "regExp": "[0-1]",
        "errorMsg": "Omr result should be 1 or 0"
    }
}
{
    "validate": {
        "regExp": "[0-5]",
        "errorMsg": "Omr result should be 0 to 5"
    }
}

How will it be used at the cell level?

  • Result OMR at cell level will be 0 or 1 if more than 1 then error message will be shown
  • Result at cell level will be 0 to 5 If more than 5 then error message will be shown
  • If the result is supposed to be between 1 to 50, if we put more than 50 then an error message will appear.
  • If the OMR result is entered wrong then we will not be able to proceed further after clicking on the Next or Submit button.
AUTO SYNC PROPERTY

Auto Sync can be controlled by following point:

i) Auto Sync

ii) Auto Sync Frequency

1. Auto Sync

autoSync property is a boolean type of property if it's is true then Auto Sync process will be execute else it won't be execute

when we hit (/schools/login) login API and if we get autoSync field as true then Auto Sync process will execute .

{
    "school": {
        "storeTrainingData": true,
        "name": "Dummy school 4",
        "schoolId": "u002",
        "state": "up",
        "autoSynch": true,
        "autoSynchFrequency": 9000
    }
}

when we hit (/schools/login) login API and if we get autoSync field as false then Auto Sync processs won't execute.

{
    "school": {
        "storeTrainingData": true,
        "name": "Dummy school 4",
        "schoolId": "u002",
        "state": "up",
        "autoSynch": false,
        "autoSynchFrequency": 9000
    }
}

2. Auto Sync Frequency

It's basically a timer which is used to trigger autosync feature once the timer is executed. when we hit (/schools/login) login API and if we get autoSyncFrequency field has the value then it'll be apply as timer in app side if we don't get this field then timer will be use as default

{
    "school": {
        "storeTrainingData": true,
        "name": "Dummy school 4",
        "schoolId": "u002",
        "state": "up",
        "autoSynch": true,
        "autoSynchFrequency": 9000
    }
}
3. autoSyncBatchSize It indicates the count of students after which autoSync process will execute . If autoSyncBatchSize field is not present in backend then by default it will be 10 .

Layout Detection Config

Layout detection config is used for table detection of layout to be made more accurate. Earlier app allows to draw a polygon with other dots or circles and scan predictions going wrong . Now when table detection of layout is not proper then red alert message "Please focus the camera by moving up or down" is coming and not allowing it to scan until it focus to 4 black dots of layout .

example:

{
    "threshold": {
        "minWidth": 416,
        "minHeight": 289,
        "detectionRadius": 12
    }
}

i) minWidth: Minimum width of layout .

ii) minHeight: Minium height of layout .

iii) detectionRadius:- Detection Radius helps in improving accuracy of detecting correct layout area by checking dark circles radius. 12 is the default value for radius .