Canada is currently in the midst of an opioid crisis. According to the Canadian Centre on Substance Use and Addiction, there were more than 11,500 apparent opioid-related deaths between January 2016 and December 2018. These lost lives make the opioid crisis a leading public health and safety concern. Opioid overprescribing, which is a plausible result of disingenuous marketing practices, has played a role in our current opioid crisis. Provincial regulators have already investigated doctors who prescribe high doses. An unintended consequence of this investigation is that some primary care physicians now practise in a climate of fear, concerned about complaints to their governing colleges, potential investigations, or practice restrictions owing to opioid mismanagement. It is estimated that 20% of Canadians living with chronic pain might not receive adequate care. Patients experiencing chronic pain also may not be able to accurately communicate their feelings.

What it does

pain-frEEG a personalized pain management application relying on EEG signals for doctors to objectively assess patient pain levels and allow them to make informed decisions when prescribing pain medication. This is particularly applicable for patients suffering from chronic pain.

Our system will allow doctors to prescribe doses as that are as low as possible while ensuring adequate pain relief for the patient, based on objective pain measurements as read by EEG signal artifacts and informed by patient history including data on patient pain levels, responsiveness to medications, and qualitative notes.

How we built it

Our team split into a front end and back end effort.

The front end web app was designed and wireframed on Figma. It was then coded using HTML, CSS, JavaScript, and Bootstrap.

The back end opened up a Python Google Collab on which they mapped the EEG data to a 'pain rating'. The capstone to the decision making was a logistic regression ML solution. This was preceded by some preprocessing such as filtering the data for artifacts and in terms of frequency; all of which was done according to a research paper's methods that linked pain and EEG.

Reference research paper: Normalization of Pain-Evoked Neural Responses Using Spontaneous EEG Improves the Performance of EEG-Based Cross-Individual Pain Prediction (

Challenges we ran into

We weren't able to find a lot of accessible datasets for our specific needs online. This is something we will look into more in the future to tweak and train our model. For front-end, we started off by using a software called Anvil to build our web app, but we ran into a lot of problems and had to switch gears. Also, a lot of us are first-time developers and hackers. We didn't have a lot of background coding so we had to learn a lot along the way!

Accomplishments that we're proud of

Of finishing the ML model, wireframing our app interface on Figma, and researching into the opioid crisis to really understand the scope of the problem.

What we learned

How to collaborate on a project online! Especially since our team came from different time zones and had different commitments over the weekend, we needed to adapt quickly and maintain clear communication.

What's next for pain-frEEG

We're looking into connecting it to EEG hardware (e.g. Muse Headband) and testing out our ML model using real data. We're also hoping to finish the development of our web application and connecting the front-end with the back-end model to display real-time EEG and pain score data.

Share this project: