Wouldn’t it be nice to know with certainty whether that beef you purchased at the supermarket is really safe to eat? Or if it's time to throw out that carton of milk that's been sitting in the fridge?

The best before labels don’t tell consumers if their products are contaminated with bacteria such as, E. coli or salmonella, and it can take days to test for an outbreak in a lab.

Now, a team of researchers from McMaster University in Hamilton, Ont. have devised an innovative way to detect harmful pathogens on the spot.

A team led by Tohid Didar, an assistant professor of mechanical engineering, along with a group headed by Carlos Filipe, the chair of the school’s chemical engineering department, and biochemist Yingfu Li collaborated to create a transparent test patch called the “Sentinel Wrap.”

Researchers print specific molecules that are able to recognize the presence of certain bacteria onto the patch and attach it to the packaging of food, Didar explained during a phone interview with CTVNews.ca on Thursday.

“Part of the whole packaging could contain those molecules that we print,” Didar said.

Lead author Hanie Yousefi, a graduate student and research assistant in McMaster's Faculty of Engineering, said the thin, flexible patch will have the molecule sensors on one side of it to detect bacteria after it’s installed onto the food packaging. The patch itself would not affect the food inside the package.

The test patch would then be scanned by a handheld device, such as a cellphone, in the supermarket to see if there are any harmful bacteria present, Didar said.

“The beauty here is that you don’t need to open the packaging [to test it]” he said. “We wanted to have a system where you can find out on the spot, in real time.”

The researchers say the technology could replace best before date stamps on food packages.

“In the future, if you go to a store and you want to be sure the meat you're buying is safe at any point before you use it, you'll have a much more reliable way than the expiration date," Yousefi said.

The application for the patch has the potential to go beyond bacteria detection in food. Didar said the same technology could be used in bandages to detect an infection in a wound or to test surfaces in hospitals for potentially contagious bacteria.

For now, Didar said Li’s team in biomedical sciences is currently developing more sensors to detect other kinds of bacteria in addition to the E. coli sample they have already tested. He said the researchers still need to conduct further studies and they would need a commercial partner and regulatory approvals before the patch could go to market.

The researchers said mass production of the patch would be fairly inexpensive and simple because the molecules used to detect bacteria can be printed onto the test material.

“This is quite innovative compared to previous work where you always had to analyze it [in the lab]” Didar said. “We’re really excited about it.”

The findings have been published in the journal ACS Nano.