Cool Summer in Belfast!

Hello everyone,

 

I am really enjoying the cool summer here in Belfast, especially with all the Early Stage Researchers (ESR) gathering together here at Queen’s University Belfast attending the 3rd FoodSmartphone Summer School. The summer school mainly focused on software development with topics such as smartphone App development, cloud services, software engineering, and entrepreneurship. And it was a big success thanks to the enthusiasm of all the participants and contributions of the organisers and speakers!

 

D826hDGXkAIO3XT
Visiting Bushmills whiskey factory

Most excitingly, we all ESRs presented our research progress in front of the FoodSmartphone consortium in Bushmills, Northern Ireland. The nice town is famous for the production of the famous and historical Bushmills whiskey. We also toured the Bushmills whiskey factory and witnessed the production of Bushmills whiskey – now it is highly automated production line with quality control!

Talking about quality control, we are developing smartphone analysers for low-cost, portable, and rapid food analysis that can be used for on-site food quality control. I am developing image analysis algorithms that can be used to improve accuracy and automation of smartphone optical biosensing. Eventually, these algorithms would be able to promote on-site food analysis by novice end-users.

Since I am an algorithm lover, below introduces an algorithm that I have come up with named FoodSmartphone food analysis algorithm (FSP-FAA) that can be used to demonstrate the workflow of our FoodSmartphone biosensors which would enable on-site food analysis. The algorithm was designed to demo the key ideas of our FoodSmartphone project. So please do not take the parameters and outputs seriously (just for fun).

Algorithm1

To visualise the FSP-FAA and make it fun to play, I have created the following code in JavaScript:


document.body.innerHTML = '';
document.body.style.display = "block";

var p = document.createElement('h1');
p.textContent = 'Hello, welcome to try out the FoodSmartphone Food Analysis Algorithm!';
document.body.appendChild(p);

var biosensor = document.createElement("input");
biosensor.type = "text";
biosensor.style.width = "100%";
biosensor.id = "biosensor";
biosensor.placeholder = "Biosensor (e.g. FoodSmartphone)";
document.body.appendChild(biosensor);

var analyte = document.createElement("input");
analyte.type = "text";
analyte.style.width = "100%";
analyte.id = "analyte";
analyte.placeholder = "Target analyte (e.g. allergens)";
document.body.appendChild(analyte);

var start = document.createElement("button");
start.type = "button";
start.innerHTML = "Click me to start analysing!";
document.body.appendChild(start);

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

start.onclick = async function fun() {
    var b_text = document.getElementById("biosensor").value;
    var a_text = document.getElementById("analyte").value;
    if (b_text.toLowerCase() != "FoodSmartphone".toLowerCase()) {
        await sleep(2000);
        r = Math.random();
        e = Math.random() * 0.4 - 0.2;
        document.getElementById("result").innerHTML = r + e;
        document.getElementById("error").innerHTML = e;
        return;
    }

    if (!a_text.toLowerCase().includes("allergen") && !a_text.toLowerCase().includes("bacteria") && !a_text.toLowerCase().includes("pesticide") && !a_text.toLowerCase().includes("toxin")) {
        document.getElementById("result").innerHTML = "Not supported yet";
        return;
    }
    await sleep(1000);
    r = Math.random();
    e = Math.random() * 0.2 - 0.1;
    l = 0.5;
    document.getElementById("result").innerHTML = r + e > l ? "Not safe" : "Safe";
    document.getElementById("error").innerHTML = e;
}

var result = document.createElement("p");
result.textContent = "Result:";
document.body.appendChild(result);

var res = document.createElement("label");
res.id = "result";
document.body.appendChild(res);

var error = document.createElement("p");
error.textContent = "Error:";
document.body.appendChild(error);

var err = document.createElement("label");
err.id = "error";
document.body.appendChild(err);

 

And this code can be ran in your web browser! Just follow these 4 simple steps to try it out by yourself:

 

Step 1: Open an arbitrary webpage (e.g. http://foodsmartphone.eu/).

 

Step 2: Open the console in your web browser on a desktop or laptop.

Most web browsers on desktop or laptop will allow opening of the JavaScript console by pressing F12 (Chrome and Internet Explorer) on your keyboard. If it does not work for your computer and browser, please follow this link for more details (https://www.wickedlysmart.com/hfjsconsole/). Then, the console can be opened by following the “console” tab.

pic1

 

Step 3: Copy the JavaScript code above, paste it into the console, and press enter to run it!

pic2

 

Step 4: The program will appear in the current webpage. Play with it in your browser!

pic3

 

Okay, hope you enjoyed playing around with the Do-It-Yourself (DIY) small program in your browser! You can also modify the parameters in the code to see how the result will be affected. Please leave a comment below if you have any idea or question. And thank you very much for reading the blog!

 

Until next time,

 

Best regards,

Jack

1 comment on “Cool Summer in Belfast!

  1. Pingback: How Can Information Technology Help Shape a Better Food Supply System? – FoodSmartphone ESR Blogs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: