Ulfa Octaviani

All projects

Personal

Corn Planting Predictor for Java

An AI tool that turns weather forecasts into plain-language planting advice for smallholder corn farmers in Java, Indonesia.

Role
Research, prompt design and development
Timeline
2026
Languages
JavaScript, HTML
Methods and tools
Gemini API, Gemini Canvas, BMKG data
Plant10 mm/dayDay 1Day 14
Onset rule from the prompt: over 10 mm a day for 3 days in a row. Illustrative data.

Process

  1. Research the domain first

    Studied corn agronomy in Java, including the key climate variables, the planting calendar and soil moisture needs, before writing any code.

  2. Source the data

    Identified weather sources including Indonesia's meteorological agency (BMKG), the Open-Meteo API and historical rainfall datasets.

  3. Build the scaffold

    Used AI-assisted coding in Gemini to build a JavaScript web app that generates a 7-day forecast and gives advice for each growth stage.

  4. Engineer the prompt

    Rewrote the system prompt over several iterations to ground it in local agronomy and make the output readable for farmers.

  5. Validate against standards

    Compared recommendations with published planting calendars from BPTP, Indonesia's agricultural technology assessment institute, for Central Java.

The problem

Java's smallholder corn farmers, mostly in Central and East Java, face growing climate unpredictability. Rainy seasons start earlier or later than historical averages, and planting too early or too late relative to the first rains significantly cuts yields. Most farms are under 2 hectares, and farmers rely on generational knowledge of planting seasons that climate change is making less reliable.

The national weather agency (BMKG) publishes forecasts but not planting recommendations, and agricultural extension services are under-resourced. Nothing bridged weather data and planting decisions for someone without agronomy training.

BMKG map of Central Java showing rainfall for the second ten days of April 2026 by regency, coloured from very low (under 10 mm, dark brown) to very high (over 300 mm, dark green). Rainfall varies sharply across short distances, with dry areas along the south and north coasts and wetter areas inland.
Rainfall analysis for Central Java, second ten-day period of April 2026, from BMKG's Central Java climatology station. Rainfall varies sharply between neighbouring regencies, which is why one regional calendar doesn't fit every farm.

Prompt design

The quality of the advice depended far more on the system prompt than on the model. The first version produced generic advice:

You are an agricultural assistant. Given weather forecast data, advise on the best time to plant corn.

By the third iteration, the prompt carried local context and a clear output format:

You are an agricultural advisor for smallholder corn farmers in Java, Indonesia. Given a 14-day weather forecast for a specific regency, advise on optimal planting windows. Consider: rainfall onset (>10mm/day for 3 consecutive days signals monsoon onset), soil moisture recovery time, and the risk of planting into a dry spell. Output must be in plain language suitable for a farmer without agronomy training. Provide a recommended planting window, a risk level (low / medium / high), and one sentence of reasoning.

The tool

Farmers choose their province on Java and their crop's current growth stage, such as planting and germination. The tool then shows a 7-day forecast with temperature, rainfall, humidity and growing degree days (GDD), a measure of how much heat the crop accumulates for growth, along with the 7-day GDD total and advice for that stage.

The Corn Farmer Weather Advisor interface. Dropdowns for location, set to West Java, and growth stage, set to planting and germination. A banner shows 113.5 growing degree days accumulated over 7 days, above a 7-day forecast table with minimum and maximum temperature, rainfall, humidity and daily GDD for 30 April to 6 May.
The advisor for West Java at the planting stage, with the 7-day forecast and growing degree days.
The tool shared as a Gemini Canvas app on a phone, showing a 7-day forecast table for West Java from 22 to 28 November with temperature, rainfall, humidity and GDD.
The same tool shared as a Gemini Canvas app and opened on a phone.

In this prototype, the forecast is simulated from typical wet- and dry-season ranges for Java rather than pulled from a live weather service.

JavaScript code for a function called generateWeatherForecast. It decides whether the current month falls in the wet season (October to March), sets base temperature and humidity ranges for tropical Java, and generates seven days of values, with a high chance of 10 to 50 mm rain in the wet season and a lower chance of 1 to 16 mm in the dry season.
The code that generates the simulated 7-day forecast, using different rain chances and amounts for the wet and dry seasons.

What I learned

Context in the prompt matters more than the model. Local thresholds, like the monsoon onset rule, are what made the advice actionable rather than obvious.

Readable output is a design problem. "14-day precipitation accumulation exceeds 80mm" is accurate but useless to a farmer. The output format is a UX decision, and it lives in the prompt.

Validation against domain standards is essential. Recommendations matched BPTP planting calendars in normal seasons but diverged in years with unusual rainfall, which is a real limitation.

Delivery is the bigger barrier. An accurate predictor only helps if farmers can reach it. Smartphone use in rural Java is growing, but data costs remain high, so SMS or WhatsApp would probably reach more people than a web app.