Jeddah: Fuelled by caffeine, pizza and adrenaline, sleep-deprived programmers in a marathon Saudi contest this week explored high-tech solutions to prevent a repeat of past calamities in the annual hajj pilgrimage.
In a cavernous hall in the Red Sea city of Jeddah, thousands of software professionals and students competed in the kingdom's first-ever hackathon, a coding festival ahead of the world's largest pilgrimage later this month.
The hajj, expected to draw more than two million pilgrims to Mecca this year, represents a key rite of passage for Muslims and a massive logistical challenge for Saudi authorities, with colossal crowds cramming into relatively small holy sites.
Launching headlong into 36 hours of software development, the participants from across the globe battled sleep deprivation to crowd source answers to a key question that has long vexed hajj organisers - how to avert future deadly disasters.
A group of five Saudi, Yemeni and Eritrean women, all in their 20s and covered head-to-toe in the Islamic niqab, hunched over their laptops to design an app for paramedics to speedily reach people in need of medical attention using geo-tracking technology.
If multiple emergencies arise at once, the women hoped their app would help prioritise the most pressing cases.
Two Pakistani professionals paired up with two East Asian students to develop a "virtual leash" application to locate relatives lost in the sea of humanity by using bluetooth wristbands.
Four Saudi men sought to design sensors for garbage bins that would alert cleaners when they are full to avert any hygiene scare.
And another group of Saudi women scrawled algorithms and programming codes on a whiteboard to design an app to help non-Arabic speakers translate instructions into multiple languages without an internet connection.
With nearly 3,000 programmers - who ate and slept at the venue - organisers said Saudi Arabia had broken the Guinness World Record for the largest number of participants at a hackathon.
While their solutions are still untested, the event, which ended on Friday and offered cash prizes of around two million riyals (USD 533,000), was billed as an invention marathon by organisers.
"We aim to upgrade the experience of hajj for all pilgrims from all over the world," said Nouf al-Rakan, chief executive of the Saudi Federation for Cyber Security and Programming, which organised the event.
"This (hackathon) will enrich that experience, will give us plenty of solutions and ideas that we can actually adapt and invest in," she told AFP.
Saudi Arabia's custodianship of Mecca and Medina - Islam's two holiest sites - is seen as the kingdom's most powerful form of political legitimacy.
But a series of deadly disasters over the years have prompted criticism of the Sunni kingdom's management of the annual pilgrimage, most notably from arch rival and Shiite powerhouse Iran.
In September 2015, a stampede killed up to 2,300 worshippers - including hundreds of Iranians - in the worst disaster ever to strike the pilgrimage.
Earlier that month, 100 people were killed when a construction crane toppled into a courtyard of Mecca's Grand Mosque.
The tragedies prompted scathing criticism from Iran's supreme leader Ayatollah Ali Khamenei, who said the Saudi ruling family did not deserve to manage Islam's holiest sites.
"I imagine the Saudi authorities are very anxious to avoid a repeat of past mishaps that could reflect badly on the 'modernising' narrative around Crown Prince Mohammed bin Salman," said Kristian Ulrichsen, a fellow at Rice University's Baker Institute in the US.
Prince Mohammed's Vision 2030 reform plan seeks to shift the economy of Saudi Arabia - the world's top crude exporter - away from oil dependency towards other sources of revenue, including religious tourism.
The scheme for the post-oil era aims to draw six million hajj pilgrims annually. Additionally, the kingdom hopes to attract another 30 million pilgrims to umrah, a lesser pilgrimage to Mecca that can be completed during the rest of the year.
Last October, Saudi Arabia's Public Investment Fund announced plans to set up two investment companies to develop infrastructure in Mecca and Medina, in a bid to accommodate the increasing numbers of Muslim pilgrims.
Last year's hajj passed without major health or safety upsets, but a politicisation of the hajj remains a concern amid regional rivalries.
Saudi Arabia and its allies are also embroiled in a political boycott of neighbouring Qatar, which denies accusations of fostering close ties with Iran and backing extremism.
"For the Saudi ruling elite, its custodianship of the two holy sites is arguably more sensitive this year in the wake of the heightened tension in the region," Ulrichsen said....