HONG KONG — Singapore takes pride in being a technology hub where municipal decisions are driven by cutting-edge data science.

“Data is the new currency, and with open data, the possibilities are endless!” the government says on its “smart nation” portal.

But that image has been dented by two embarrassing data breaches.

Last year, a cyberattack on Singapore’s public health system compromised data from 1.5 million people. And on Monday, the Health Ministry said that medical records for 14,200 H.I.V.-positive people in the city-state had been obtained by an American whose Singaporean partner worked at the ministry. The ministry said it learned on Jan. 22 that the records had been illegally disclosed online.

Experts say the breaches highlight the potential pitfalls for Singapore and other countries that are pushing to make vast troves of data more accessible and centralized. Do the public benefits justify the inherent risks to privacy? And can anyone prevent senior officials from misusing information they have at their fingertips?