Image copyright AP

A urine test that can reveal how healthy your meals are has been developed by UK scientists.

They think it could be used to improve nutritional advice or in weight loss because people are notoriously bad at recording their own eating habits.

The test, detailed in the Lancet Diabetes and Endocrinology, detects chemicals made as food is processed by the body.

The research team believe it could be widely available within two years.

The urine samples are analysed to determine the structure of the chemicals floating around in it using a technique called a proton nuclear magnetic resonance spectroscopy.

This gives clues to both recent meals and long term dietary habits.

Gut health

The results of your body processing fruit, vegetables, fish and different types of meat leave a distinct signature in the urine.

Clues to the state of the body's metabolism and gut health can also be detected by investigating the chemicals in it.

The test was developed by a collaboration between Imperial College London, Newcastle University and Aberystwyth University.

Dr Isabel Garcia-Perez, one of the researchers at Imperial, said: "This will eventually provide a tool for personalised dietary monitoring to help maintain a healthy lifestyle.

"We're not at the stage yet where the test can tell us a person ate 15 chips yesterday and two sausages, but it's on the way."

Image copyright Thinkstock Image caption Could urine be more accurate than food diaries?

In trials, around 60% of people either under or over report what they are eating.

Prof Gary Frost, another scientist at Imperial, said this could be the first independent test of what people munch on at home.

He told the BBC News website: "You can really tell whether someone's been following a healthy diet or not.

"The bigger you are the more likely you are to under-report what you eat.

"People find it difficult to open up to what types of foods they eat at home, which is a major problem."

The researchers believe the test results could help combat people's obesity or risk of diseases such as type 2 diabetes.

Prof Frost said: "If someone is very big and their profile says they're eating lots of energy dense foods like meat, then you can try to change that profile and then test them again later.

"It remains to be seen, but people might respond better to that and there is a desperate need for tools to help people change their diet."

He says doing the test on large numbers of people would build up a picture of what the nation was really eating, which could be used to design better public health campaigns.

The scientists were able to spot the difference between healthy and unhealthy diets after tests on 19 people who spent days eating a carefully controlled set of meals.

Four diets of varying degrees of healthiness were given to the patients and their urine was sampled morning, noon and night.

Dr Des Walsh, from the UK Medical Research Council, commented: "Though this research is still in its early stages, it's grappling with essential methods in food and diet studies where advances are really needed.

"Measuring what we eat and drink more accurately will widen the benefits of nutrition research, developing better evidence-based interventions to improve an individual's health and reduce obesity."

Follow James on Twitter.