ai-cfia / fertiscan-frontend

Frontend code for the `Fertiscan` project
MIT License
2 stars 1 forks source link

Label inspection schema refactor #229

Open k-allagbe opened 2 months ago

k-allagbe commented 2 months ago

Context

After discussing with our main user / tester, we came to the conclusion that refactoring the label inspection data schema is necessary. This will impact all fertiscan layers.

Desired outcome

The label inspection form contains all the required fields and eliminates all the superfluous ones.

Tasks

Frontend

Backend

Pipeline

Datastore

Additional information

New label analysis data format

{
  "company_name": "GreenGrow Inc.",
  "company_address": "123 Green Road, Farmville, State, 12345",
  "company_website": "https://www.greengrow.com",
  "company_phone_number": "123-456-7890",
  "manufacturer_name": "AgriSupply Co.",
  "manufacturer_address": "456 Supply Lane, AgriTown, State, 67890",
  "manufacturer_website": "https://www.agrisupply.com",
  "manufacturer_phone_number": "987-654-3210",
  "fertiliser_name": "GreenGrow Fertilizer 20-20-20",
  "registration_number": "FG123456",
  "lot_number": "LOT20240901",
  "weight": [
    {
      "value": 50,
      "unit": "kg"
    }
  ],
  "density": {
    "value": 1.5,
    "unit": "g/cm³"
  },
  "volume": {
    "value": 33.3,
    "unit": "L"
  },
  "npk": "20-20-20",
  "guaranteed_analysis_en": {
    "title": "Guaranteed Analysis",
    "nutrients": [
      {
        "nutrient": "Total Nitrogen (N)",
        "value": 20,
        "unit": "%"
      },
      {
        "nutrient": "Available Phosphate (P2O5)",
        "value": 20,
        "unit": "%"
      },
      {
        "nutrient": "Soluble Potash (K2O)",
        "value": 20,
        "unit": "%"
      }
    ]
  },
  "guaranteed_analysis_fr": {
    "title": "Analyse Garantie",
    "nutrients": [
      {
        "nutrient": "Azote total (N)",
        "value": 20,
        "unit": "%"
      },
      {
        "nutrient": "Phosphate assimilable (P2O5)",
        "value": 20,
        "unit": "%"
      },
      {
        "nutrient": "Potasse soluble (K2O)",
        "value": 20,
        "unit": "%"
      }
    ]
  },
  "ingredients_en":[
    {
      "nutrient":"Bone meal",
      "value":5,
      "unit":"%"
    },
    {
      "nutrient":"Seaweed extract",
      "value":3,
      "unit":"%"
    },
    {
      "nutrient":"Humic acid",
      "value":2,
      "unit":"%"
    },
    {
      "nutrient":"Clay"
    },
    {
      "nutrient":"Sand"
    },
    {
      "nutrient":"Perlite"
    }
  ],
  "ingredients_fr":[
    {
      "nutrient":"Farine d'os",
      "value":5,
      "unit":"%"
    },
    {
      "nutrient":"Extrait d'algues",
      "value":3,
      "unit":"%"
    },
    {
      "nutrient":"Acide humique",
      "value":2,
      "unit":"%"
    },
    {
      "nutrient":"Argile"
    },
    {
      "nutrient":"Sable"
    },
    {
      "nutrient":"Perlite"
    }
  ],
  "cautions_en": [
    "Keep out of reach of children.",
    "Store in a cool, dry place."
  ],
  "cautions_fr": [
    "Garder hors de la portée des enfants.",
    "Conserver dans un endroit frais et sec."
  ],
  "instructions_en": [
    "Apply evenly across the field at a rate of 5 kg per hectare.",
    "Water thoroughly after application."
  ],
  "instructions_fr": [
    "Appliquer uniformément sur le champ à raison de 5 kg par hectare.",
    "Arroser abondamment après l'application."
  ]
}

New inspection data format

{
    "inspection_id": "61c93c2f-78ae-4f90-be3c-fc888087bfb9",
    "inspection_comment": "User's feedback and notes of the inspection"
    "verified": false,
    "company": {
        "id": "dbd48ad7-3d3d-4b93-affc-55a427f11331",
        "name": "GreenGrow Fertilizers Inc.",
        "address": "123 Greenway Blvd, Springfield IL 62701 USA",
        "website": "www.greengrowfertilizers.com",
        "phone_number": "+1 800 555 0199"
    },
    "manufacturer": {
        "id": "fb3b5366-0bc0-49a3-9f2b-1c860a337b8c",
        "name": "AgroTech Industries Ltd.",
        "address": "456 Industrial Park Rd, Oakville ON L6H 5V4 Canada",
        "website": "www.agrotechindustries.com",
        "phone_number": "+1 416 555 0123"
    },
    "product": {
        "name": "SuperGrow 20-20-20",
        "label_id": "cdca3638-a3c0-45df-8c72-74e28a8740c6",
        "registration_number": "F12345678",
        "lot_number": "L987654321",
        "metrics": {
            "weight": [
                {
                    "value": 25.0,
                    "unit": "kg",
                    "edited": false
                },
                {
                    "value": 55.0,
                    "unit": "lb",
                    "edited": false
                }
            ],
            "volume": {
                "value": 20.8,
                "unit": "L",
                "edited": false
            },
            "density": {
                "value": 1.2,
                "unit": "g/cm",
                "edited": false
            }
        },
        "npk": "20-20-20",
        "n": 20.0,
        "p": 20.0,
        "k": 20.0
    },
    "cautions": {
        "en": [
            "Avoid contact with skin and eyes.",
            "Keep out of reach of children."
        ],
        "fr": [
            "\u00c9viter le contact avec la peau et les yeux.",
            "Tenir hors de port\u00e9e des enfants."
        ]
    },
    "instructions": {
        "en": [
            "3. Store in a cool, dry place.",
            "2. Apply every 2 weeks.",
            "1. Dissolve 50g in 10L of water."
        ],
        "fr": [
            "3. Conserver dans un endroit frais et sec.",
            "2. Appliquer toutes les 2 semaines.",
            "1. Dissoudre 50g dans 10L d'eau."
        ]
    },
    "guaranteed_analysis" : {
        "title": "Guaranteed Analysis",
        "titre": "Analyse Garantie",
        "is_minimal" : false,
        "en" : [
            {
              "nutrient": "Total Nitrogen (N)",
              "value": "20",
              "unit": "%"
            },
            {
              "nutrient": "Available Phosphate (P2O5)",
              "value": "20",
              "unit": "%"
            },
            {
              "nutrient": "Soluble Potash (K2O)",
              "value": "20",
              "unit": "%"
            }
          ],
        "fr" : [
            {
              "nutrient": "Azote total (N)",
              "value": "20",
              "unit": "%"
            },
            {
              "nutrient": "Phosphate assimilable (P2O5)",
              "value": "20",
              "unit": "%"
            },
            {
              "nutrient": "Potasse soluble (K2O)",
              "value": "20",
              "unit": "%"
            }
        ]
    }
}
Francois-Werbrouck commented 2 months ago

I've updated the output of an Inspection JSON to add the comment and added the information into the each relevant issues