A new online tool will help doctors predict which patients are most likely to develop diabetes.
The calculator will help doctors identify high risk patients so that they can be tested for the disease and offered lifestyle advice. The test is targeted at people who have been admitted to hospital for emergency care.
Experts say it could offer a cost-effective way to identify people with diabetes in Scotland as it avoids the need for significant investment in screening.
The test calculates a person's risk of developing diabetes over the next three years based on their age, sex and the level of sugar in their blood, which is routinely measured on admission to A&E.
Blood sugar levels often rise during serious illness but usually drop back to normal when patients get better. This can make it difficult for doctors to identify patients who are at risk of diabetes, which is also associated with high levels of sugar in the blood.
The calculator will help doctors determine which patients should be referred for diabetes testing when they recover. It was developed by a team led by the University of Edinburgh's Centre for Population Health Sciences, the University of Glasgow and members of the Scottish Diabetes Research Network.
The team linked records from more than 100,000 hospital patients to a national diabetes register to get the information needed to create the calculator.
Dr David McAllister, a Clinical Lecturer in Epidemiology and Public Health at the University of Edinburgh, said: "This tool will enable us to identify people at risk of diabetes and give them the opportunity to make positive lifestyle changes to improve their health, without the cost of running a national screening programme."