zacoppotamus / ElgarsCodingOrchestra

2nd Year Software Engineering Project
project.spe.sneeza.me
3 stars 0 forks source link

Fix constraint bug where auto constrain is not correctly applied #136

Closed BenElgar closed 10 years ago

BenElgar commented 10 years ago

When constraints are automatically applied to the dataset generated by uploading the example csv "CF95D_03.csv" with data such as:

{
    "_id": "53382c57365caf2a318b46f5",
    "District": "All districts",
    "Total suspects in matters declined*": 35896,
    "Violent offenses": 5.3,
    "Property offenses: Fraudulent": 40.1,
    "Property offenses: Other": 4.7,
    "Drug offenses": 20.7,
    "Public-order offenses: Regulatory": 9.9,
    "Public-order offenses: Other": 19.2
},
{
    "_id": "53382c57365caf2a318b46f6",
    "District": "Alabama, Middle",
    "Total suspects in matters declined*": 140,
    "Violent offenses": 6.4,
    "Property offenses: Fraudulent": 32.9,
    "Property offenses: Other": 5.7,
    "Drug offenses": 25,
    "Public-order offenses: Regulatory": 10.7,
    "Public-order offenses: Other": 19.3
},
{
    "_id": "53382c57365caf2a318b46f7",
    "District": "Alabama, Northern",
    "Total suspects in matters declined*": 592,
    "Violent offenses": 4.3,
    "Property offenses: Fraudulent": 28.2,
    "Property offenses: Other": 4.6,
    "Drug offenses": 40.4,
    "Public-order offenses: Regulatory": 12.6,
    "Public-order offenses: Other": 9.9
},
{
    "_id": "53382c57365caf2a318b46f8",
    "District": "Alabama, Southern",
    "Total suspects in matters declined*": 128,
    "Violent offenses": 4.7,
    "Property offenses: Fraudulent": 49.2,
    "Property offenses: Other": 6.3,
    "Drug offenses": 21.9,
    "Public-order offenses: Regulatory": 3.9,
    "Public-order offenses: Other": 14.1
}

The constraint "integer" is applied to the "Violent offences" field, resulting in most being nullified like so:

{
    "_id": "53382c57365caf2a318b46f5",
    "District": "All districts",
    "Total suspects in matters declined*": 35896,
    "Violent offenses": null,
    "Property offenses: Fraudulent": 40.1,
    "Property offenses: Other": 4.7,
    "Drug offenses": 20.7,
    "Public-order offenses: Regulatory": 9.9,
    "Public-order offenses: Other": 19.2
},
{
    "_id": "53382c57365caf2a318b46f6",
    "District": "Alabama, Middle",
    "Total suspects in matters declined*": 140,
    "Violent offenses": null,
    "Property offenses: Fraudulent": 32.9,
    "Property offenses: Other": 5.7,
    "Drug offenses": 25,
    "Public-order offenses: Regulatory": 10.7,
    "Public-order offenses: Other": 19.3
},
{
    "_id": "53382c57365caf2a318b46f7",
    "District": "Alabama, Northern",
    "Total suspects in matters declined*": 592,
    "Violent offenses": null,
    "Property offenses: Fraudulent": 28.2,
    "Property offenses: Other": 4.6,
    "Drug offenses": 40.4,
    "Public-order offenses: Regulatory": 12.6,
    "Public-order offenses: Other": 9.9
},
{
    "_id": "53382c57365caf2a318b46f8",
    "District": "Alabama, Southern",
    "Total suspects in matters declined*": 128,
    "Violent offenses": null,
    "Property offenses: Fraudulent": 49.2,
    "Property offenses: Other": 6.3,
    "Drug offenses": 21.9,
    "Public-order offenses: Regulatory": 3.9,
    "Public-order offenses: Other": 14.1
}