Esteban Granero has some good news, a little light at the end of a long, dark tunnel in Spain, where the coronavirus crisis has left more than 21,000 people dead. “The situation is terrible,” says the midfielder, a league title winner with Real Madrid, “but the curve is clearly downward now; we reached the peak on the fourth [of April] and now we’re on the way down. Things shift daily but we think at the end of the month, early May, the number of cases will be very low and there will be room for optimism.”

Granero does not speak lightly. He has been watching the trends carefully. Not just watching them, in fact: he has been helping to map, measure and predict the number of those infected in Spain. The former Queens Park Rangers, Madrid and Real Sociedad midfielder, who has just moved from Espanyol to the Second Division B side Marbella on a mission to take them to primera, is the founder and chief executive of Olocip, an artificial intelligence company engaged in the fight against the virus.

Daily Covid-19 tests and biodegradable kit bags: La Liga's plan to restart season Read more

“We’ve built a model that estimates and predicts the number of cases and tracks the evolution of those numbers,” he says. “That allows us to anticipate potential problems in the mobilisation of resources. It predicts, for example, which regions will need masks and respirators, enabling you to anticipate supply. The model can also simulate distancing measures, measuring how changes in the lockdown impact upon the curve, foreseeing trends and helping us prevent a second wave.”

All of which might sound like an unexpected activity for a footballer, but it started with the game. The advances that Granero and his team spent years working on are being applied to the pandemic, their findings available to health authorities. “Throughout my career, I saw the information gathered, how it was analysed and used, and it was pretty deficient,” he says. “Some decisions were taken in an arbitrary way, and I thought there had to be a means of producing analyses that was not just descriptive but predictive.”

Facebook Twitter Pinterest Esteban Granero in action for Espanyol against Leganés in December, before his move to Marbella. Photograph: Perez Meca/MB Media/Getty Images

Granero, who began studying psychology at Complutense University in Madrid, contacted Pedro Larrañaga and Concha Bielza five years ago. Professors of AI at the Universidad Politécnica and “two of the most important scientists in Europe” according to Granero, they and he worked with a network of data analysts, doctors and scientists to fine-tune their models.

“The principal error in descriptive analysis is that it doesn’t respond to the question the club is actually asking,” Granero says. “If you’re looking at a player to sign, I’m not so interested in what he did last year as asking: ‘Look, if I sign this player, how will he work here, in my context?’ And that answer can only be provided by artificial intelligence.

“People tend to think of AI as a kind of magic; it’s not, it’s analysis. It’s not a rejection of intuitive, ‘inside’ football knowledge, either. Or machine over man. Quite the opposite. You need intuition, understanding, to even identify the variables to be measured. The role of the expert is primordial, defining the analysis you need.

“For example, you might ask: ‘How can we get this player in this area of the pitch and generate a chance in fewer than three passes?’ You can measure that, analyse it, and generate statistics on a descriptive level but also measure that as a predictive variable, enabling you to identify players who can perform that role. Applying the data in a predictive manner is the big leap.

“I wouldn’t call football mechanised but everything you do is susceptible to being converted into data, although there are intangibles, chance. What we do is build the tools that strengthen an expert’s ability: a sporting director, say, or a doctor preventing injuries. In the same way a mathematician uses a calculator, we provide the tool that facilitates the process. We always say that human and machine working together are much stronger than either on their own.

“Uncertainty can never be zero. These are models of probability, not deterministic. It’s not a crystal ball. What it can tell you scientifically is that there is a certain type of player in the third division in Holland, say, that if you sign him there’s a 95% chance he will score between 12 and 15 goals.”

Facebook Twitter Pinterest Esteban Granero playing for QPR against Chelsea 2012. Photograph: Tom Jenkins/The Guardian

Asked how often the model is right, Granero replies: “The normal thing is for it to get it right. Lots, lots, lots of players finish with the numbers predicted. At most you’re talking one or two off. The prediction models are tested, validated, held against reality. It’s not an easy process: some time ago these models didn’t exist and we have worked at this, getting it right. When you see it works, the results are powerful. With so much in play and with these tools now available to help you take decisions better, bloody hell, it’s your responsibility to do so.”

There is far more in play now and the responsibility is greater. “I got a call from a friend of mine who had created a platform called Stop Corona, asking if we wanted to help predict the evolution of the virus,” Granero says. “We thought we had the tools to help and that it was our responsibility to contribute. We’re providing the model free; there are lives at stake.

“The official numbers can confuse things. When there’s such an evident shortfall in the number of tests, when there are so many people who have caught it without it being tested, you know that’s not the real number. It’s a diagnostic reality, not a true measure of the people with the virus. The real number can be estimated by a model like ours.

The Fiver: sign up and get our daily football email.

“We started when the state of alarm was announced. The model suggested something we now know: that if had it been declared sooner, the curve could have lower, smaller and recovery would have happened sooner. That’s happened in countries all over the world, not just Spain. But some countries anticipated, using AI. Canada watched, predicted the impact of the epidemic and moved ahead of it.

“Equally you can project backwards, and if measures had been adopted two weeks later the dimension of the catastrophe would have been unimaginable. The exponential growth would have been prolonged, contagion on a scale that doesn’t bear thinking about.

“Our people are experts in their field, prestigious scientists, and we’re not playing around with this. The data we provide is not law: it’s analysed and interpreted by doctors, epidemiologists, mathematicians. We can’t take decisions; what we can do is ensure the model is absolutely reliable to help doctors, nurses, medical staff on the frontline, putting themselves at risk every day. They’re the heroes; the least we can do is put ourselves at their disposal, give what we can.”