YOU ARE CURRENTLY USING THE STAGING ENVIRONMENT

Saving assessments using the CFT

This topic guide explains how to send data to the CFT’s creation modules.

Warning

Users should be warned and advised that this feature is currently in development, and you may notice unusual behavior when using it.

Please send anything you notice to tech@coolfarmtool.org and we will investigate it as soon as possible.

Note

All URLs start with /api/v1/.

Crop assessment

Note

When saving a crop product to the database, and you want to use the crop product as a dairy feed item, you will need to create (or use an existing crop product), either in the user interface or using the guide below, ensuring that you send your choice of feed_type. Choices are available on the Feed_components item page

"crop": {
    "type": "Potato",
    "feed_type": null, <--
    "field_size": {
        "value": 100,
        "unit": "ha"
    },
},
POST /crop_product/

Create a crop product and save it to the database

Example request

POST /crop_product/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": "United States of America",
      "territory": "Alabama",
      "climate": "temperate",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "farm_identifier": ""
    },
    "crop": {
      "type": "Potato",
      "feed_type": null,
      "field_size": {
        "value": 100,
        "unit": "ha"
      },
      "soil": {
        "texture_id": 1,
        "organic_matter_id": 2,
        "moisture_id": 1,
        "drainage_id": 1,
        "ph_id": 4,
        "organic_matter_custom": null
      },
      "product_fresh": {
        "value": 1000,
        "unit": "tonne"
      },
      "product_finished": {
        "value": 990,
        "unit": "tonne"
      },
      "residue": {
        "value": null,
        "unit": null,
        "management": "Left distributed on field, OR incorporated, OR mulched"
      },
      "seed_amount": {
        "value": 10,
        "unit": "tonne"
      }
    },
    "pesticides": [
      {
        "applications": 1,
        "category_id": 3,
        "percentage_rate": 100,
        "application_rate": {
          "value": 1,
          "unit": "kg / acre"
        }
      }
    ],
    "fertilisers": [
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_total_percentage": 0.0,
          "n_ammonia_percentage": 0.0,
          "n_nitric_percentage": 0.0,
          "n_urea_percentage": 0.0,
          "p2o5_percentage": 0.0,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 0.0,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 15,
          "unit": "kg / ha"
        },
        "rate_measure": "product",
        "method": 2,
        "inhibition_id": 1,
        "added_within_20_years": false,
        "years_ago": null,
        "allocation": null
      }
    ],
    "machinery": [
      {
        "operations": 1,
        "machinery": 24,
        "fuel_type": "diesel"
      }
    ],
    "irrigation": [
      {
        "method": 1,
        "water_source": 1,
        "allocation": 100,
        "pumping_depth": {
          "value": 1,
          "unit": "m"
        },
        "horizontal_distance": {
          "value": 2,
          "unit": "km"
        },
        "water_added": {
          "value": 2,
          "unit": "ha-mm"
        },
        "power_source": 1
      }
    ],
    "direct_energy": [
      {
        "category": "irrigation",
        "source": "diesel",
        "usage": {
          "value": 1000,
          "unit": "litre"
        }
      }
    ],
    "land_management": [
      {
        "change_id": 10,
        "years_ago": 1,
        "allocation": 100,
        "forest": {
          "type": "temperate oceanic forest",
          "age_years": 1
        }
      }
    ],
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 4,
          "unit": "tonne"
        },
        "distance": {
          "value": 2000,
          "unit": "km"
        }
      }
    ],
    "tree_biomass": [
      {
        "tree_type": 5,
        "density_last_year": {
          "value": 100,
          "unit": "trees / hectare"
        },
        "size_last_year": {
          "value": 10,
          "unit": "cm"
        },
        "size_this_year": {
          "value": 15,
          "unit": "cm"
        },
        "num_trees_delta": {
          "value": 1,
          "unit": "trees / hectare"
        }
      }
    ],
    "co_products": [
      {
        "name": "test_co_product",
        "percentage_main_value": 50
      }
    ],
    "processing": [
      {
        "_type": 1,
        "allocation": 100,
        "power_source": 102
      }
    ],
    "storage": [
      {
        "cipc_application": 1,
        "cipc_dose": 1,
        "storage_power_source": 106,
        "store_loading_power_source": 102,
        "unloading_power_source": 102,
        "stored_allocation": 100,
        "temperature": {
          "unit": "°C",
          "value": 5
        },
        "time": {
          "unit": 46,
          "value": 1
        }
      }
    ],
    "waste_water": {
      "waste_water_production": {
        "unit": 15,
        "value": 12
      },
      "oxygen_demand": {
        "unit": 18,
        "value": 15
      },
      "oxygen_demand_type": 1,
      "water_treatment_type": 1
    }
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "crop_product_uri": "https://app.coolfarmtool.org/crop_product/ABC123/",
    "crop_product_slug": "ABC123"
  }
]
Request Headers
Status Codes

Dairy assessment

Note

When saving a dairy product to the database which uses a crop product as a feed item, you will need to create an existing crop product, either in the user interface or the API as specified in the Crop assessment section of this documentation.

{
    "herd_section": "Dairy calves",
    "crop_product": {
        "type": "Soyabean",
        "slug": null, <--
        "product_dry": {
            "value": 5,
            "unit": "tonne"
        },
        "feed_type": "Soybean",
        "emissions_total": {
            "value": 22469.393582158074,
            "unit": "kg CO2e"
        }
    },
},
POST /dairy_product/

Create a dairy product and save it to the database

Example request

POST /dairy_product/calculate/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": 840,
      "territory": "Wisconsin",
      "climate": "temperate",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "farm_identifier": ""
    },
    "general": {
      "grazing_area": {
        "value": 50,
        "unit": "ha"
      },
      "feed_approach": "dmi",
      "fertilisation_approach": 1
    },
    "milk_production": {
      "variety": "Normande",
      "reporting_year": 2019,
      "date_time": "start",
      "date_month": 1,
      "name": "normande_2019",
      "product_dry": {
        "value": 500000,
        "unit": "litre"
      },
      "fat_content": 4.2,
      "protein_content": 3.5,
      "protein_measure": 1
    },
    "herd_sections": [
      {
        "phase": "Dairy calves",
        "animals": 40,
        "live_weight": {
          "value": 166,
          "unit": "kg"
        },
        "sold_animals": 15,
        "sold_weight": {
          "value": 166,
          "unit": "kg"
        },
        "purchased_animals": 10,
        "purchased_weight": {
          "value": 166,
          "unit": "kg"
        }
      },
      {
        "phase": "Meat calves",
        "animals": 30,
        "live_weight": {
          "value": 230,
          "unit": "kg"
        },
        "sold_animals": 10,
        "sold_weight": {
          "value": 230,
          "unit": "kg"
        },
        "purchased_animals": 5,
        "purchased_weight": {
          "value": 230,
          "unit": "kg"
        }
      },
      {
        "phase": "Milk cows",
        "animals": 100,
        "live_weight": {
          "value": 555,
          "unit": "kg"
        },
        "sold_animals": 5,
        "sold_weight": {
          "value": 555,
          "unit": "kg"
        },
        "purchased_animals": 0,
        "purchased_weight": {
          "value": 555,
          "unit": "kg"
        }
      }
    ],
    "grazing": [
      {
        "herd_section": "Dairy calves",
        "days": 100,
        "hours": 12,
        "category": 2,
        "quality": 1
      },
      {
        "herd_section": "Meat calves",
        "days": 100,
        "hours": 12,
        "category": 3,
        "quality": 2
      },
      {
        "herd_section": "Milk cows",
        "days": 150,
        "hours": 12,
        "category": 2,
        "quality": 1
      }
    ],
    "fertilisers": [
      {
        "type": "Ammonium nitrate - 33.5% N (prilled)",
        "production": "Europe 2014",
        "custom_ingredients": {},
        "application_rate": {
          "value": 30,
          "unit": "kg / ha"
        },
        "rate_measure": ""
      },
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_ammonia_percentage": 6,
          "n_total_percentage": 12,
          "n_nitric_percentage": 4,
          "n_urea_percentage": 2,
          "p2o5_percentage": 8,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 4,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 20,
          "unit": "kg / ha"
        },
        "rate_measure": ""
      }
    ],
    "feed_components": [
      {
        "herd_section": "Dairy calves",
        "item": "Grass fresh managed - on farm",
        "dry_matter": {
          "value": 0.41,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Maize / corn grain",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Oats",
        "dry_matter": {
          "value": 4,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "crop_product": {
          "type": "Soyabean",
          "slug": null,
          "product_dry": {
            "value": 5,
            "unit": "tonne"
          },
          "feed_type": "Soybean",
          "emissions_total": {
            "value": 22469.393582158074,
            "unit": "kg CO2e"
          }
        },
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Compound dairy feed: Belgium (65% soy)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Grass fresh managed - on farm",
        "dry_matter": {
          "value": 0.62,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Maize / corn grain",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "crop_product": {
          "type": "Soyabean",
          "product_dry": {
            "value": 5,
            "unit": "tonne"
          },
          "feed_type": "Soybean",
          "emissions_total": {
            "value": 22469.393582158074,
            "unit": "kg CO2e"
          }
        },
        "dry_matter": {
          "value": 8,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Soybean cake/meal",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Milk cows",
        "item": "Straw",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Milk cows",
        "crop_product": {
          "type": "Soyabean",
          "product_dry": {
            "value": 5,
            "unit": "tonne"
          },
          "feed_type": "Soybean",
          "emissions_total": {
            "value": 22469.393582158074,
            "unit": "kg CO2e"
          }
        },
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      }
    ],
    "manure": [
      {
        "herd_section": "Dairy calves",
        "type": "Solid storage",
        "allocation": 100
      },
      {
        "herd_section": "Milk cows",
        "type": "Aerobic treatment - natural aeration",
        "allocation": 100
      }
    ],
    "bedding": [
      {
        "type": 621,
        "quantity": {
          "value": 100,
          "unit": "kg"
        }
      }
    ],
    "direct_energy": [
      {
        "source": "diesel",
        "usage": {
          "value": 1200,
          "unit": "litre"
        },
        "category": 1
      },
      {
        "source": "electricity (grid)",
        "usage": {
          "value": 1000,
          "unit": "kWh"
        },
        "category": 1
      }
    ],
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 5,
          "unit": "tonne"
        },
        "distance": {
          "value": 3500,
          "unit": "km"
        }
      }
    ]
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "dairy_product_uri": "https://app.coolfarmtool.org/dairy_product/ABC123",
    "dairy_product_slug": "ABC123"
  }
]
Request Headers
Status Codes