Databases
Table of Contents
- Our Databases
1.1 Main Database (SQL Database) 1.1.1 DER Diagram
1.1.2 ER Diagram
1.2 MEC Storage (MongoDB Database) 1.2.1 Example of a MEC Document Structure (Stored in MongoDB)
Our Databases
To store our data about universities, student, tutors, evaluations, we had to choose a main database that supported our requirements, but also provided us with scalability, reliability and performance.
Main Database (SQL Database)

For this main database we opted for MySQL. This is a relational database that is widely used and has a lot of support from the community. It is also very easy to use and has a lot of features that make it a great choice for our application, starting with how we can have a define structure for our data.
It also provides us with strong ACID compliance, the scalability we needed, a lot of support for Spring Boot and performance optimizations.
DER Diagram

ER Diagram

MEC Storage (MongoDB Database)

However, we also needed a way of storing our MECs. These can vary a lot in structure and size, so we needed a database that could handle this, since the way MECs are organized may change in the future. We chose MongoDB for this task.
It is a NoSQL database that is very flexible and works well with volatile data. It is also easy to use when uploading MEC information.
Example of a MEC Document Structure (Stored in MongoDB)
Here’s an example of how we store a MEC document in our MongoDB collection. Each document represents a MEC (Marco Educatico Clínico) with the current autonomy level, its version, and all steps included in the procedure.
{
"_id": 1,
"filename": "MEC_Prescrição alimentar.pdf",
"name": "Prescrição alimentar/ plano dietético/ aconselhamento alimentar",
"version": "V12024",
"autonomy_level": "N1",
"academic_year": "2024/2025",
"procedure": [
{
"step": "1",
"description": "Preparação: Avaliar a disponibilidade/motivação para a mudança dos hábitos alimentares inadequados (só avança para as próximas etapas se apresentar disponibilidade). Avaliação breve e inicial dos hábitos alimentares. Avaliar a motivação e auto-eficácia para a mudança de comportamentos alimentares. Avaliar a importância/barreiras para a mudança de comportamentos."
},
{
"step": "2",
"description": "Aconselhamento alimentares: Aplicar, se necessário, o modelo dos 5Rs para aumentar a motivação do utente para a mudança dos seus hábitos alimentares. Aplicar o guia dos 10 passos para o aconselhamento breve para a promoção da alimentação saudável. Apoiar a definir um plano de ação e a definir objetivos/metas a alcançar."
},
{
"step": "3",
"description": "Encerramento: Se possível, acompanhar o processo de mudança e avaliar a necessidade de referenciação."
}
],
"bibliography": [
"DGS - ACONSELHAMENTO BREVE PARA A ALIMENTAÇÃO SAUDÁVEL NOS CUIDADOS DE SAÚDE PRIMÁRIOS: MODELO DE INTERVENÇÃO E FERRAMENTAS. 2020."
],
"resources": ["https://www.youtube.com/watch?app=desktop&v=b7dAKYvLaXE"]
}
Each MEC entry typically contains:
- A descriptive name and versioning
- The filename (PDF or other resource)
- Academic year and autonomy level
- A procedure array detailing each step in the process
- A bibliography for references
- External resources (e.g., videos, pdfs or links)
This flexible format allows us to adapt to changes in structure or content over time, one of the core reasons we chose MongoDB.