1. Trang chủ
  2. » Luận Văn - Báo Cáo

principles of database management final report topic mental healthcare system

66 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Mental Healthcare System
Tác giả Nguyen Hoang Anh Tu, Nguyen Quang Dieu, Pham Minh Vu, Nguyen Luan Cong Bang, Huynh Tran Khanh
Người hướng dẫn Assoc. Prof. Nguyen Thi Thuy Loan
Trường học International University
Chuyên ngành Principles of Database Management
Thể loại Final Report
Thành phố Ho Chi Minh City
Định dạng
Số trang 66
Dung lượng 1,37 MB

Cấu trúc

  • I. INTRODUCTION (5)
    • 1. Abstract (5)
    • 2. System Overview (5)
    • 3. Goal (6)
    • 4. The techniques & tools used (7)
  • II. TASK TIMELINE & DIVISION (8)
    • 1. Contribution (8)
    • 2. Project Timeline & Task Division (8)
  • III. PROJECT ANALYSIS (11)
    • 1. Requirements Analysis (11)
    • 2. Approach Analysis (11)
      • 2.1 Reviewed Materials (11)
      • 2.2 Research Approach (11)
    • 3. System Analysis (12)
      • 3.1 Database Design (12)
      • 3.2 Database and Tables Creation (13)
      • 3.3 Database Data Insertion (20)
      • 3.4 Database Queries (28)
    • 4. Application Java structure (37)
      • 4.1 Project structure (37)
      • 4.2 Class structure (39)
      • 4.3 Connection implementation (40)
      • 4.4 G.U.I. Design – Frames implementation (48)
      • 4.5 Buttons implementation (53)
      • 4.6 Application Demo – Screenshots (58)
  • IV. CONCLUSION (64)
    • 1. Achieved goals (64)
    • 2. Future work (64)
    • 3. Concluding thoughts (64)
  • V. REFERENCES (66)

Nội dung

These features included account creation, searching for disease symptoms and solutions, finding reservations with psychological specialists, and conducting mental health tests.. To addre

INTRODUCTION

Abstract

The Principles of Database Management course project involved developing a mental healthcare services system with several features These features included account creation, searching for disease symptoms and solutions, finding reservations with psychological specialists, and conducting mental health tests The project also emphasized creating a perfect database that adhered to the B.C normal form The database design process logically defined data entities, relationships, attributes, and constraints Achieving the B.C normal form ensured data integrity, eliminated anomalies, and optimized data retrieval and storage ("1NF, 2NF, 3NF, and BCNF in Database Normalization | Studytonight," n.d.) The logical design was meticulously crafted to ensure system efficiency, reliability, and scalability The database contained data uploaded by reputable organizations from around the world This ensured that the information stored in the database was credible and dependable The system's user interface was designed to be user-friendly, enabling easy access to various features The search function allowed users to find information about disease symptoms and solutions quickly The reservation system provided a straightforward way to schedule appointments with psychological specialists

The mental health test feature also allowed users to assess their mental health status Overall, the project provided a valuable opportunity to apply database management principles to a real-world problem in the field of mental health It underscored the significance of efficient and reliable data management in this domain The thoughtful approach to system features and design demonstrated a commitment to developing a robust mental healthcare system The project showcased the practical application of database management principles in addressing challenges in mental health.

System Overview

The global pandemic has profoundly impacted mental health, resulting in increased recognition of the importance of psychological therapy ("Depression," n.d.) In recent years, there has been a significant shift in attitudes towards therapy, with more individuals acknowledging its benefits and seeking professional help for their mental health concerns

However, accessing traditional therapy can still be challenging for many people due to factors such as long waitlists, high costs, and the enduring stigma associated with mental health ("Suicide mortality rate (per 100,000 population) | Data," n.d.)

To address these barriers and meet the growing demand for mental health services, online therapy platforms have emerged as a popular and accessible option These platforms offer a wide range of mental health services, including individual and group therapy sessions, online resources, and support from licensed therapists One of the critical advantages of online therapy is its flexibility, allowing individuals to schedule sessions at their convenience and receive therapy from the comfort of their homes Moreover, these platforms often offer more affordable pricing than traditional in-person therapy, making therapy accessible to a broader audience

Among the well-known online therapy platforms are BetterHelp, Talkspace, and Amwell BetterHelp provides various therapy options, including live sessions, messaging, and chat support Talkspace specializes in unlimited messaging therapy with licensed therapists On the other hand, Amwell offers mental health services as part of its broader telehealth platform, including access to medical doctors and specialists

The COVID-19 pandemic has further highlighted the significance of online therapy platforms With social distancing measures in place, many individuals have turned to these platforms to continue receiving mental health support Online therapy offers the added benefits of anonymity and privacy, which can be particularly appealing to those who may feel hesitant about seeking therapy in person due to stigma or other concerns

It is important to note that while online therapy platforms offer numerous advantages, they are not a substitute for traditional therapy, especially for individuals with severe mental health conditions These platforms, however, provide a valuable resource for individuals seeking mental health support, offering a convenient and accessible alternative to in-person therapy While they are not a replacement for all types of therapy, online platforms have become a valuable tool in supporting individuals' mental well-being and addressing the increased demand for psychological support in today's challenging times.

Goal

- Design the database to suit the requirements of Normalization BC Normal Form

- Connect the front-end interface (application) to the back-end database using a Java connection driver

- Develop the functions such as login, account creation, and booking; take a test using complex queries

- Evaluate the data and give more precise predictions in the future for the users

- Take security measures in the database to ensure robust privacy for the users' data and prevent any hacking into the system (known as SQL Injection).

The techniques & tools used

- SQL Server manages data in a relational database management system (RDBMS) using the SQL Server Management Studio and free hosting from www.freeasphosting,net, which stores our database remotely

- Java language using JetBrains IntelliJ IDEA GUI design the interface for users from the database and application logic flow

- Figma to design briefly about the interface

- Version Control System from GitHub to easily collaborate on the project

- Some other means of contact: are Microsoft Teams and Notion

TASK TIMELINE & DIVISION

Contribution

Table 1 Individual responsibility and contribution

Nguyen Hoang Anh Tu Database Developer, Data Analyst 20% Nguyen Quang Dieu Interface Developer, Data Analyst 20%

Nguyen Luan Cong Bang Interface Developer 20%

Pham Minh Vu Interface Developer 20%

Huynh Tran Khanh Interface Developer 20%

Project Timeline & Task Division

Table 2 Sprint planning and task division for individuals and teams

Research technical information about mental symptoms, tests, and treatments

Collect sample data for analyzing Tu

Research for references and technical documentation Tu

Agree on communication, workflow, and tools to use All

Determine scopes, learning objectives, and goals for the project All

Analyze proper approach and methodology for project development All

Specify requirements for the project All

Determine proper technology stack and database management system All

Propose necessary features and their priorities All

Phase 1 review and retrospective All

Identify use cases and actors of the system All

Specify types of information that are 3 essential to be stored in the database Tu, Dieu

Design user interface for core functionalities Dieu

Design the relational models Tu

Prepare the E.R diagram and Class 4 diagram Tu, Dieu

Phase 2 review and retrospective All

Database creation and setup All

5 ~ 12 Setup database tables, their relationship, and constraints Tu

Implement necessary queries for each functionality Tu

Develop application interface and client-side functionalities Bang, Vu, Khanh

Work on new user registration Khanh

Work on user login/logout and authentication Khanh

Develop searching system among specialists, diseases, symptoms, and solutions through queries

Develop a booking system between specialists and patients Vu

Develop mental health test system and give the approach sets based on the tests' results

Phase 3 review and retrospective All

Code review and refactoring Bang, Vu, Khanh

Bug detection and fixing Bang, Vu, Khanh

Design and implement test cases All

Fix and modify the application until stable All

Phase 4 review and retrospective All

PRESENTATION Final report Tu, Dieu

PROJECT ANALYSIS

Requirements Analysis

The proposed project aims to develop a comprehensive mental healthcare system with features including secure account login, password reset, and user roles for patients and specialists Users can access and extract data based on their role and request additions to the system's database Patients can take tests to identify psychological disorders and receive recommended solutions The system will provide information on common mental illnesses, symptoms, and potential solutions.

Approach Analysis

- Advanced SQL Server language structure ("SQL Tutorial," n.d.).

- Java, JDBC, Swing Worker official usage documents ("Lesson: JDBC Basics (The Java TM Tutorials > JDBC Database Access)," n.d.), ("SwingWorker (Java Platform S.E

The Scrum framework, a part of the Agile approach, has been adopted for the project Teams can deliver products using Scrum, which emphasizes adaptability and responsiveness to change in iterative and incremental stages It is frequently called an "agile project management framework" and concentrates on controlling circumstances to manage time and expense Traditional project management techniques, on the other hand, focus on set requirements to manage time and costs To support efficient project management, Scrum uses several strategies, including time boxes, group rituals, a prioritized product backlog, and regular feedback loops b) Process

The product backlog, which serves as a to-do list for the project, contains the features The team sets a sprint backlog with features and activities at the sprint planning meeting by choosing the product backlog items they think can be completed during the sprint period When the team decides on the sprint backlog, they begin working on the assigned tasks with a single, undivided concentration on reaching the sprint goal The product backlog can be altered before the start of the subsequent sprint, while the sprint backlog is left alone during the sprint

The team meets for a 15-minute scrum during the sprint to discuss remaining tasks, offer updates on their progress, and resolve any issues they encounter Each team member presents their work to the other members of the team, who provide insightful feedback that helps them plan the subsequent sprint and make required modifications The three Scrum pillars of transparency, inspection, and adaptability, which stress the value of open communication, ongoing review, and the capacity to adjust to changing conditions, serve as the framework for these meetings.

System Analysis

Figure 1 Primary Crow's Foot Format E.R.D Diagram

Figure 2 Schema design created by using SQL Server Moreover, our database has achieved the highest B.C normal form because of the following table:

1 N.F The database does not have any multivalued tuples

2 N.F All the non-key attributes depend on the primary key

3 N.F There are no transitive dependencies between non-key attributes

BC N.F Every non-trivial functional dependency in the database depends on a candidate key

This part discusses the database creation, schemas, and tables following the E.R.D the diagram in SQL Server Database: a Database Creation

USE [congbang0711_] b Schemas and Tables Analysis

The current version of the Entity-Relationship Diagram (E.R.D.) has the following twelve entities:

Table 4 An overview of all database entities and their attributes

User_ID bigint IDENTITY(1, 1) PRIMARY KEY User_name varchar(50) NOT NULL

Password varbinary(20) NOT NULL Salt varchar(100) NOT NULL

Specialist_ID int IDENTITY(1, 1) PRIMARY KEY UserID bigint NOT NULL

FullName varchar(50) NOT NULL DoB date NOT NULL

Sex varchar(10) NOT NULL Email varchar(50) NOT NULL Phone varchar(15) NOT NULL IndentifyNumber varchar(50) NOT NULL GraduationUniversity varchar(50) NOT NULL

Patient_ID int IDENTITY(1, 1) PRIMARY KEY UserID bigint NOT NULL

FullName varchar(50) NOT NULL DoB date NOT NULL

Sex varchar(10) NOT NULL Email varchar(50) NOT NULL

SpecialistID int NOT NULL Place varchar(50) NOT NULL Date date NOT NULL

Description varchar(200) NOT NULL Extra_Information varchar(100)

Result_ID int PRIMARY KEY TestID int NOT NULL

Weight int NOT NULL Description varchar(200)

Solution_ID int PRIMARY KEY Name varchar(50) NOT NULL Type varchar(50) NOT NULL Benefit varchar(50) NOT NULL Platform varchar(30) NOT NULL Description varchar(400))

Disease_ID int PRIMARY KEY Name varchar(50) NOT NULL Description varchar(200) NOT NULL

Symptom_ID int PRIMARY KEY Name varchar(50) NOT NULL Description varchar(100) NOT NULL)

Test_ID int PRIMARY KEY Total int

No_Question int DiseaseID int NOT NULL

Question_ID int PRIMARY KEY TestID int NOT NULL

Title varchar(500) NOT NULL AnswerSetID int NOT NULL

Answer Set AnswerSet_ID int PRIMARY KEY

No_Answer int NOT NULL

Answer_ID int PRIMARY KEY Title varchar(100) NOT NULL Weight int NOT NULL

From the above table, we can conclude some requirements as follows: o The Account table has a field of Password that contains the binary result from the SHA1 hashing result with randomly generated Salt ("Add a Salt with the SQL Server HASHBYTES Function," n.d.) o The Patient and Specialists tables have fields that store user information and can be extracted for their actions with the system o The HealingInformation table is responsible for healing reservations between patients and specialists o The Disease and Symptom tables store the information users can search using their names o The Test, Question, AnswerSet, Answer, Result, and

Solution tables serve to conduct tests and solutions given per patient and track their records after taking tests c Account Schema Account Table:

CREATE TABLE [Account].[Account] ([User_ID] [bigint] IDENTITY(1, 1) PRIMARY KEY,

[User_name] [varchar](50) NOT NULL,

CREATE TABLE [Account].[Patient] ([Patient_ID] [int] IDENTITY(1, 1) PRIMARY KEY,

FOREIGN KEY(UserID)REFERENCES [Account].[Account](User_ID))

CREATE TABLE [Account].[PatientRecord] ([ID] [int] PRIMARY KEY,

FOREIGN KEY(PatientID)REFERENCES [Account].[Patient](Patient_ID),

FOREIGN KEY(ResultID)REFERENCES [Test].[Result](Result_ID))

CREATE TABLE [Account].[Specialist] ([Specialist_ID] [int] IDENTITY(1, 1) PRIMARY KEY,

FOREIGN KEY(UserID)REFERENCES [Account].[Account](User_ID)) d Booking Schema HealingInformation Table:

CREATE TABLE [Booking].[HealingInformation] ([HealingInformation_ID] [int] IDENTITY(1, 1) PRIMARY KEY,

[Date] [date] NOT NULL CHECK(Date>CAST(GetDate() as Date)),

FOREIGN KEY(SpecialistID)REFERENCES [Account].[Specialist](Specialist_ID))

CREATE TABLE [Booking].[Booking] ([Book_ID] [int] IDENTITY(1, 1) PRIMARY KEY,

[HealingInformationID] [int] NOT NULL UNIQUE,

FOREIGN KEY(PatientID)REFERENCES [Account].[Patient](Patient_ID),

[Booking].[HealingInformation](HealingInformation_ID)) e Disease Schema Disease Table:

CREATE TABLE [Disease].[Disease] ([Disease_ID] [int] PRIMARY KEY,

CREATE TABLE [Disease].[Symptom] ([Symptom_ID] [int] PRIMARY KEY,

CREATE TABLE [Disease].[DiseaseSymptom] ([ID] [int] PRIMARY KEY,

FOREIGN KEY(DiseaseID)REFERENCES [Disease].[Disease](Disease_ID),

FOREIGN KEY(SymptomID)REFERENCES [Disease].[Symptom](Symptom_ID)) f Test Schema Test Table:

CREATE TABLE [Test].[Test] ([Test_ID] [int] PRIMARY KEY,

FOREIGN KEY(DiseaseID)REFERENCES [Disease].[Disease](Disease_ID))

CREATE TABLE [Test].[Result] ([Result_ID] [int] PRIMARY KEY,

FOREIGN KEY(TestID)REFERENCES [Test].[Test](Test_ID))

CREATE TABLE [Test].[Question] ([Question_ID] [int] PRIMARY KEY,

FOREIGN KEY(TestID)REFERENCES [Test].[Test](Test_ID),

FOREIGN KEY(AnswerSetID)REFERENCES [Test].[AnswerSet](AnswerSet_ID))

CREATE TABLE [Test].[AnswerSet] ([AnswerSet_ID] [int] PRIMARY KEY,

[No_Answer] [int] NOT NULL)

CREATE TABLE [Test].[AnswerSetContent] ([ID] [int] PRIMARY KEY,

FOREIGN KEY(AnswerID)REFERENCES [Test].[Answer](Answer_ID),

FOREIGN KEY(AnswerSetID)REFERENCES [Test].[AnswerSet](AnswerSet_ID))

CREATE TABLE [Test].[Answer] ([Answer_ID] [int] PRIMARY KEY,

[Weight] [int] NOT NULL) g Solution Schema Solution Table:

CREATE TABLE [Solution].[Solution] ([Solution_ID] [int] PRIMARY KEY,

CREATE TABLE [Solution].[Recommendation] ([ID] [int] PRIMARY KEY,

FOREIGN KEY(SolutionID)REFERENCES [Solution].[Solution](Solution_ID),

FOREIGN KEY(ResultID)REFERENCES [Test].[Result](Result_ID))

CREATE TABLE [Solution].[CureOneByOne] ([ID] [int] PRIMARY KEY,

FOREIGN KEY(SolutionID)REFERENCES [Solution].[Solution](Solution_ID),

FOREIGN KEY(SymptomID)REFERENCES [Disease].[Symptom](Symptom_ID))

3.3 Database Data Insertion a Source of data insertion

In general, the data insert into the database comes from three primary sources: o Self-generated data for testing purposes, as in Account, Patient, Specialist, HealingInformation o Look up the web for accurate data such as Disease, Symptom, Test, Question, AnswerSet, Answer, Result, and Solution ("FREE Mental Health Tests, Quizzes, Self-Assessments, & Screening Tools," 2022) o When the system goes public, the data from real user input is considered and validated before inputting into the database o We also have some update and removal procedures for users to make changes to suit their needs

In this report, the first five rows of each table are demonstrated to preview the data insert only, and the complete data can be found using the backup file attached to this report b Account Schema Account Table:

INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])

0xDD4689A6BF12DFA64DDD713199BA53B51F65AD53)

INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])

INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])

INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])

INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])

VALUES(5, N'congbang', N'5Sj%3', 0xC17EDC261652EC7CD357BC6850B8962B9EE9216A)

INSERT [Account].[Patient]([Patient_ID], [UserID], [FullName], [DoB], [Sex], [Email])

VALUES(1, 1, N'Nguyen Hoang Anh Tu', CAST(N'2002-06-13' AS Date), N'Male', N'nghganhtu@gmail.com')

INSERT [Account].[Patient]([Patient_ID], [UserID], [FullName], [DoB], [Sex], [Email])

VALUES(2, 3, N'Bui Thi Cam Van', CAST(N'2002-12-08' AS Date), N'Female', N'buicamvan.work@gmail.com')

INSERT [Account].[Patient]([Patient_ID], [UserID], [FullName], [DoB], [Sex], [Email])

VALUES(3, 4, N'Nguyen Quang Dieu', CAST(N'2002-05-29' AS Date), N'Male', N'guangyao@gmail.com')

INSERT [Account].[Patient]([Patient_ID], [UserID], [FullName], [DoB], [Sex], [Email])

VALUES(4, 5, N'Nguyen Luan Cong Bang', CAST(N'2002-11-07' AS Date), N'Male', N'congbang.1107@gmail.com')

INSERT [Account].[Patient]([Patient_ID], [UserID], [FullName], [DoB], [Sex], [Email])

VALUES(5, 7, N'Huynh Tran Khanh', CAST(N'2003-01-13' AS Date), N'Male', N'htk2003@gmail.com')

INSERT [Account].[PatientRecord]([ID], [PatientID], [ResultID])

INSERT [Account].[PatientRecord]([ID], [PatientID], [ResultID])

INSERT [Account].[PatientRecord]([ID], [PatientID], [ResultID])

INSERT [Account].[PatientRecord]([ID], [PatientID], [ResultID])

INSERT [Account].[PatientRecord]([ID], [PatientID], [ResultID])

INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB], [Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])

VALUES(1, 2, N'Lam Thanh Luan', CAST(N'1990-06-13' AS Date), N'Male',

N'lamthanhluan@gmail.com', N'0913517039', N'Sai Gon University',

INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB], [Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])

VALUES(2, 6, N'Pham Minh Vu', CAST(N'1985-06-13' AS Date), N'Male',

N'laimaybay@gmail.com', N'0947513068', N'International University',

INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB], [Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])

VALUES(5, 28, N'Trinh Duc Bao', CAST(N'2002-09-06' AS Date), N'Male',

N'trducbo@gmail.com', N'0944738291', N'International University',

INSERT [Booking].[Booking]([Book_ID], [PatientID], [HealingInformationID]) VALUES(1, 5, 1)

INSERT [Booking].[Booking]([Book_ID], [PatientID], [HealingInformationID]) VALUES(3, 2, 2)

INSERT [Booking].[Booking]([Book_ID], [PatientID], [HealingInformationID]) VALUES(5, 1, 4)

INSERT [Booking].[Booking]([Book_ID], [PatientID], [HealingInformationID]) VALUES(6, 1, 8)

INSERT [Booking].[HealingInformation]([HealingInformation_ID],

[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information]) VALUES(1, 1, N'Quan 3', CAST(N'2023-05-01' AS Date), 300000.0000, N'I will help you to get out of your mental problem within 1 hour', N'Please come in the morning')

INSERT [Booking].[HealingInformation]([HealingInformation_ID],

[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information]) VALUES(2, 2, N'Quan 1', CAST(N'2023-05-01' AS Date), 400000.0000, N'If you need help, come to me', NULL)

INSERT [Booking].[HealingInformation]([HealingInformation_ID],

[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information]) VALUES(4, 2, N'Quan 1', CAST(N'2023-05-05' AS Date), 400000.0000, N'If you need help, come to me', N'I am free in the afternoon')

INSERT [Booking].[HealingInformation]([HealingInformation_ID],

[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information]) VALUES(5, 2, N'Quan 1', CAST(N'2023-05-06' AS Date), 400000.0000, N'If you need help, come to me', NULL)

INSERT [Booking].[HealingInformation]([HealingInformation_ID],

[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information]) VALUES(6, 2, N'Quan 1', CAST(N'2023-05-13' AS Date), 400000.0000, N'If you need help, come to me', NULL) d Disease Schema

INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])

VALUES(1, N'Depression', N'Depression is a mood disorder that causes a persistent feeling of sadness and loss of interest.')

INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])

VALUES(2, N'Stress', N'Stress is a consequence of experiencing pressure or tension.')

INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])

VALUES(3, N'Anxiety', N'Anxiety is an emotion caused by a perceived or experienced threat, which often leads to an avoidance or evasion thereof.') INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])

VALUES(4, N'Borderline', N'Borderline is a personality disorder People with borderline have fast-changing feelings toward friendship, love, and so on.') INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])

VALUES(5, N'Migraine', N'Migraine is an illness, where regular intense attacks of headache occur In the case of migraine, this headache often only takes place at one side of the head, and causes a pounding type of pain')

INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])

INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])

INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])

VALUES(3, N'Having fewer feelings', N'Mental')

INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])

INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])

INSERT [Disease].[DiseaseSymptom]([I.D.], [DiseaseID], [SymptomID])

INSERT [Disease].[DiseaseSymptom]([I.D.], [DiseaseID], [SymptomID])

INSERT [Disease].[DiseaseSymptom]([I.D.], [DiseaseID], [SymptomID])

INSERT [Disease].[DiseaseSymptom]([I.D.], [DiseaseID], [SymptomID])

VALUES(5, 1, 2) e Test Schema Test Table:

INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])

INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])

INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])

INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])

INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])

INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])

INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])

INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])

INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])

INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])

INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID]) VALUES(1, 1, N'Little interest or pleasure in doing things?', 1)

INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])

VALUES(2, 1, N'Feeling down, depressed, or hopeless?', 1)

INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID]) VALUES(3, 1, N'Trouble falling or staying asleep, or sleeping too much?', 1) INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID]) VALUES(4, 1, N'Feeling tired or having little energy?', 1)

INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID]) VALUES(5, 1, N'Poor appetite or overeating?', 1)

INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(1, 4)

INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(2, 5)

INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(3, 2)

INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(4, 3)

INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(5, 2)

INSERT [Test].[AnswerSetContent]([I.D.], [AnswerSetID], [AnswerID])

INSERT [Test].[AnswerSetContent]([I.D.], [AnswerSetID], [AnswerID])

INSERT [Test].[AnswerSetContent]([I.D.], [AnswerSetID], [AnswerID])

INSERT [Test].[AnswerSetContent]([I.D.], [AnswerSetID], [AnswerID])

INSERT [Test].[AnswerSetContent]([I.D.], [AnswerSetID], [AnswerID])

INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])

INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])

INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])

VALUES(3, N'More than half the days', 2)

INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])

INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])

VALUES(5, N'Never', 0) f Solution Schema Solution Table:

INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],

VALUES(1, N'Sheep in Dream', N'Game', N'Sleep', N'Mobile App', N'Sheep in Dream is a game about getting a boy to sleep by making sheep jump over a log The sheep are in the top left corner of the screen on a dream hill and the boy is in his bed at the bottom ')

INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],

VALUES(2, N'Love is in small things', N'Game', N'Relationship', N',Mobile App', N'Love is…in small things is one of the romantic games made by Lunosoft The game showcases the lively artwork of a South Korean artist who goes by the name Puuung and is a romantic title')

INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],

VALUES(3, N'My Oasis: Relaxing, Satisfying', N'Game', N'Communicate-Calm', N'Mobile App', N'My Oasis: Anxiety Relief Game is a relaxing game that helps in calming your mind, relieve your stress This anti anxiety game helps in relaxation and calm sleeping.')

INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],

VALUES(4, N'Focus Plant: Pomodoro timer', N'App', N'Focus', N'Mobile App', N'Focus is a gamified focus study timer app to help people better manage their time and focus on the important things in their life Some times self- discipline is just not enough to keep us away from the phones This is when gamification comes in, the in-game achievements encourage users to stick with the app, better manage their time and get things done.')

INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],

VALUES(5, N'Wokamon - Walking app game', N'Game', N'Exercise', N'Mobile App', N'Wokamons are running out of resources and they need your help! Every step you take is turned into energy Use it to feed, grow and collect

Wokamons The more you walk, the more Wokamons you can collect and the further you get to explore the magical Woka-worlds like candy desert, icy realm, mystical forest and more! Lend a helping hand and soon you will find, the more you help, the fitter you get!')

INSERT [Solution].[Recommendation]([ID], [SolutionID], [ResultID])

INSERT [Solution].[Recommendation]([ID], [SolutionID], [ResultID])

INSERT [Solution].[Recommendation]([ID], [SolutionID], [ResultID])

INSERT [Solution].[Recommendation]([ID], [SolutionID], [ResultID])

INSERT [Solution].[Recommendation]([ID], [SolutionID], [ResultID])

INSERT [Solution].[CureOneByOne]([I.D.], [SolutionID], [SymptomID])

INSERT [Solution].[CureOneByOne]([I.D.], [SolutionID], [SymptomID])

INSERT [Solution].[CureOneByOne]([I.D.], [SolutionID], [SymptomID])

INSERT [Solution].[CureOneByOne]([I.D.], [SolutionID], [SymptomID])

INSERT [Solution].[CureOneByOne]([I.D.], [SolutionID], [SymptomID])

Most queries shown below are in the same form of this structure to ensure the user input is sanitized, where each question mark shows it is parameterized to suit the content user data: o DECLARE AS SET: to declare additional variables used in the query o INSERT INTO VALUES: to insert data into the tables o SELECT: to show the columns for return o FROM: to specify the table use o INNER JOIN: to join the table for more linked data query o WHERE: to set a condition for each query o ORDER BY: to sort the results in ascending order o GROUP BY: to pack the same data into groups b Register account

Our system users can create accounts with two roles: Patient and Specialist In addition, we provide several features, such as password change and display of the user's name in the welcome message

The following query is used to check if user login credentials are correct and exist in the database; this query returns the role also for later use in other queries

SELECT CASE WHEN A.User_ID=P.UserID AND P.UserID IS NOT NULL THEN 'Patient'

WHEN A.User_ID=S.UserID AND S.UserID IS NOT NULL THEN 'Specialist' ELSE NULL END

AS Role, CASE WHEN A.User_ID=P.UserID AND P.UserID IS NOT NULL THEN P.Patient_ID

WHEN A.User_ID=S.UserID AND S.UserID IS NOT NULL THEN S.Specialist_ID ELSE NULL END AS

FULL JOIN [Account].[Patient] P ON A.User_ID=P.UserID

FULL JOIN [Account].[Specialist] S ON A.User_ID=S.UserID

WHERE A.User_name=@UserName AND A.Password=HASHBYTES('SHA1', CONCAT(@Pwd, (SELECT A.Salt

FROM [Account].[Account] A WHERE A.User_name=@UserName)))

The following query is used to create an account for a user with the patient role, containing basic information such as account name, password, and personal information

The password is secured by adding a salt value after each password input to create a hash, which cannot be retrieved back to string one

SET @Salt=CONCAT(CHAR(FLOOR(RAND()* 10)+48), CHAR(FLOOR(RAND()* 26)+65),

CHAR(FLOOR(RAND()* 26)+97), CHAR(FLOOR(RAND()* 15)+33), CHAR(FLOOR(RAND()* 10)+48))

INSERT INTO [Account].[Account]([User_name], [Password], [Salt])

VALUES(@Username, HASHBYTES('SHA1', CONCAT(@Pwd, @Salt)), @Salt)

INSERT INTO [Account].[Patient]([UserID], [FullName], [DoB], [Sex], [Email])

VALUES((SELECT User_ID FROM [Account].[Account] A WHERE A.User_name = ?), ?, ?, ?, ?)

The following query is used to create an account for a user with the specialist role, containing basic information such as account name, password, personal information, and identity information The password is secured by adding a salt value after each password to create a hash that cannot be retrieved back to the string value

SET @Salt=CONCAT(CHAR(FLOOR(RAND()* 10)+48), CHAR(FLOOR(RAND()* 26)+65), CHAR(FLOOR(RAND()* 26)+97), CHAR(FLOOR(RAND()* 15)+33), CHAR(FLOOR(RAND()* 10)+48))

INSERT INTO [Account].[Account]([User_name], [Password], [Salt])

VALUES(@Username, HASHBYTES('SHA1', CONCAT(@Pwd, @Salt)), @Salt)

INSERT INTO [Account].[Specialist]([UserID], [FullName], [DoB], [Sex], [Email], [Phone], [IdentifyNumber], [GraduationUniversity])

VALUES((SELECT User_ID FROM [Account].[Account] A WHERE A.User_name=?), ?, ?, ?, ?, ?, ?, ?)

This query displays the username on the system welcoming message based on the user's I.D

FROM(SELECT CASE WHEN @UserID=P.Patient_ID AND @Role='Patient' THEN P.FullName

WHEN @UserID=S.Specialist_ID AND @Role='Specialist' THEN S.FullName END AS FullName

FULL JOIN [Account].[Patient] P ON A.User_ID=P.UserID

FULL JOIN [Account].[Specialist] S ON A.User_ID=S.UserID) AS SUBQUERY

WHERE FullName IS NOT NULL

Application Java structure

For this project, the group has decided to use IntelliJ IDEA as an IDE to develop the application, which members have frequently used, and excellent community support when they get stuck This IDE also provides tools like SQL Console inside, Terminal, and

Debugging Tool for testing and assurance purposes when tackling hard-to-achieve tasks

When we first start the project, IntelliJ IDEA auto-generates the structure for the project, which is in the following figure:

Figure 3 The project structures in IDE

We can summarize the folders and files' purpose as follows: o idea: for storing IDE-specific project configurations (JDK level, the pattern, the structure, and many more) o out: the compiled code to run the application o sql: contains the SQL files used for database creation o src: the project's source code mainly contains the class and frm files used by G.U.I Designer o gitgnore, mindfulness.iml, README.md: used for project setup on GitHub Version Control System and provide based configuration per developers

Taking a closer look at each class used, we have the following UML Diagram to show the dependence of each class on others and provide a quicker view of the methods implementations

Figure 4 UML Diagram of the project

We can declare the class purpose as follows, as their corresponding class controls each frame, which we will discuss later in the G.U.I parts: o ConnectSQL.java: manages all the databases connection and return result from the query o Main.java: manages the main() function; we use this class to start the application process public class Main { public static void main(String[] args) { frmIndex.getInstance().setVisible(true);

} o frmBooking.java: manages the BOOKING frame and logic for buttons inside it for reservation booking functions o frmExplorer.java: manages the EXPLORER frame and logic for buttons inside it for admin query functions o frmIndex.java: manages the INDEX frame and logic for buttons inside it for signup/login functions This returns values to use in other methods as well o frmPatientDashboard.java: manages the PATIENT DASHBOARD frame and logic for buttons inside it for patient users o frmPatientSign.java: manages the PATIENT SIGNUP frame and logic for buttons inside it for patient registration o frmRoles.java: manages the ROLES frame and logic for buttons inside it for the role chooser function o frmSignDone.java: manages the SIGNUP DONE frame and logic for buttons inside it to take the user back to the index frame o frmSpecialistDashboard.java: manages the SPECIALIST

DASHBOARD frame and logic for buttons inside it for specialist users o frmSpecialistSign.java: manages the SPECIALIST SIGNUP frame and logic for buttons inside it for specialist registration o frmTest.java: manages the TEST frame and logic for buttons inside it for patients to take tests in the system

First, we go to the www.freeasphosting.net website to create a remote database like the figure below:

Figure 5 Free database hosting website for the project

Then we connect to the database (for use in the IDE) using the information provided and run the CREATE DATABASE, CREATE TABLE, and INSERT INTO queries above to begin initializing our database

Figure 6 Testing connection with the database

After doing all the creation, it is time to implement our ConnectSQL.java class to manage all the queries used in the project First is to import the JDBC Driver using and setting the connection URL of: import java.sql.*; import net.proteanit.sql.DbUtils; static final String connectionUrl =

"jdbc:sqlserver://sql.bsite.net\\MSSQL2016;databaseName=congbang0711_;user=con gbang0711_;password=mindfulness;encrypt=true;trustServerCertificate=true;";

Then, there are some methods to help with closing connections and displaying the result in tabular form: public static void closeConnect(Connection con) { if (con != null) { try { con.close();

System.out.println("Error closing connection");

} private static TableModel resultSetToTableModel(ResultSet rs) { try {

ResultSetMetaData metadata = rs.getMetaData(); int numberOfColumn = metadata.getColumnCount();

Vector headline = new Vector(); for (int i = 0; i < numberOfColumn; ++i) { headline.addElement(metadata.getColumnLabel(i + 1));

Vector content = new Vector(); while (rs.next()) {

Vector row = new Vector(); for (int i = 1; i 0) { isUpdated = true;

Next, we can begin to design the frames for Graphical User Interface directly on IntelliJ IDEA GUI Designer, as follows:

Figure 7 Create a new G.U.I Form in IDE From then, we can drag-and-drop the elements to the JFrame created; some of the frequent usages are:

Figure 8 G.U.I Designer Form for making a reservation o HSpacer, VSpacer: to add spacing between the elements o JPanel: to add a frame for other elements, it must be extended from our frame classes public class frmPatientDashboard extends JFrame o JButton: add a button with ActionListeners to perform logical code when clicking (discuss more in the later part) o JScrollPane: add a frame that can be scrollable, especially for long content o JLabel: to add title and instruction on the interface o JTextField, JPasswordField: to receive user input on the interface; the latter is used for the password field to protect privacy txtField.getText() txtField.setText("");

String.valueOf(pwdField.getPassword()) pwdField.setText(""); o JTextArea: to display the message after the query has been done txtArea.selectAll(); txtArea.replaceSelection(""); txtArea.setText(""); txtArea.setEditable(false); o JComboBox: to make a drop-down list for the user to choose from comboBox.setModel(new DefaultComboBoxModel(questions)); o JTable: to display the query result in tabular form table.setModel(Objects requireNonNull ( resultSetToTableModel (rs))); o JOptionPane: to display the dialog for the user to interact with

JOptionPane.showMessageDialog( null, "Field(s) are empty!", "Warning", JOptionPane.WARNING_MESSAGE);

JOptionPane.INFORMATION_MESSAGE); int option =

"Please check the information carefully!",

Object[] message = {"Master password: ", masterPwd}; int option =

To initialize the frames, we will use the constructor provided; with the use of the Singleton Design Pattern, we can save time by not reloading all the elements again as: o Default constructor public frmTest() { setContentPane(panel); setTitle("mindfulNESS - Self-diagnosis test"); setSize(1200, 800); setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

} frmTest frmTest = new frmTest(); frmTest.setVisible(true); setVisible(false); o Singleton constructor private static frmIndex instance; private frmIndex() { setContentPane(panel); setTitle("mindfulNESS - Homepage"); setSize(800, 800); setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

} public static synchronized frmIndex getInstance() { if (instance == null) { instance = new frmIndex();

} frmIndex.getInstance().setVisible(true); setVisible(false); o Frame class that returns a value also has these methods public String[] getID() { return results;

} o The frame that needs to be loaded with content uses these methods:

@Override public void setVisible(boolean visible) { super.setVisible(visible); if (isVisible()) { pwdField.setText("");

All together, they are put inside a class that runs like this with all the variables and methods for working: public class frmPatientDashboard extends JFrame {}

As many buttons need to be implemented, we will only show some common patterns for this button Note that all buttons have the logic to validate user input (blank, not long enough, duplicate, etc ) and follow the SwingWorker design pattern: o Log in, sign up buttons: use user input (account, password) for authentication and perform the subsequent actions o Run the query, Search buttons: to run the query and return the result to the interface runQueryButton.addActionListener( e -> { runQueryButton.setEnabled(false); if (queryField.getText().isEmpty()) {

JOptionPane.showMessageDialog( null, "Please do not leave query blank!", "Warning",

JOptionPane.WARNING_MESSAGE); runQueryButton.setEnabled(true); return;

SwingWorker worker = new SwingWorker() {

ConnectSQL.showQuery(queryField.getText(), resultTable); return null;

@Override protected void done() { runQueryButton.setEnabled(true);

}); o Place a booking, confirm registering, and Post booking information buttons: to put the user input into the database o Patient, Specialist Place healing Mode, Explorer Mode, and Self-test Mode buttons: to set them according to the visible frame and dispose of the current frame healButton.addActionListener( e -> { healButton.setEnabled(false);

SwingWorker worker = new SwingWorker() {

@Override protected Void doInBackground() { frmBooking frmBooking = new frmBooking(); frmBooking.setVisible(true); setVisible(false); return null;

@Override protected void done() { healButton.setEnabled(true);

CONCLUSION

Achieved goals

During the project, our team successfully achieved the goal of developing the mental healthcare system Firstly, we designed the database to adhere to the requirements of B.C Normal Form, ensuring efficient data storage and retrieval while eliminating data anomalies Secondly, we connected the front-end interface of the application to the back-end database using a Java connection driver, establishing a seamless and secure connection between the user interface and the database Thirdly, we developed essential functions such as login, account creation, and booking, implementing complex queries to manage various scenarios effectively

Additionally, we incorporated data evaluation techniques to give users more precise predictions and recommendations for their mental health Finally, we implemented robust security measures in the database to safeguard users' data and prevent unauthorized access, including protection against SQL injection attacks Through completing these goals, our project has delivered a reliable and user-friendly mental healthcare system that meets the requirements of modern database management, security, and user experience.

Future work

The achievement of these goals opens exciting possibilities for the future evolution of this project into a fully-fledged real-world application Our team is committed to enhancing the user experience by implementing more advanced features We will introduce functionalities that allow users to update their information according to their preferences, expand the role of specialists to provide additional support and resources and improve the overall interface of the application Additionally, we aim to optimize the connection process, reducing user waiting times Furthermore, we plan to integrate a scheduling system into the app, enabling users to conveniently manage their therapy appointments and receive guidance throughout their treatment journey We will focus on continuous improvement and delivering a comprehensive and user-centric mental healthcare solution as we move forward.

Concluding thoughts

In conclusion, we are optimistic about the future development and improvement of our mental healthcare service system We aspire to make the system even more user-friendly and practical, focusing on enhancing our users' overall experience Throughout the project, our team members have learned valuable lessons in collaboration, communication, and problem-solving, which will benefit us in future endeavors We sincerely thank our esteemed lecturers for their guidance and support, without which this project would not have been possible We are grateful for the opportunity to contribute to the mental health field and look forward to positively impacting the lives of individuals seeking support and care With a commitment to continuous learning and innovation, we are excited about the potential of our mental healthcare service system and its ability to improve the well-being of our users.

Ngày đăng: 22/07/2024, 17:18

Nguồn tham khảo

Tài liệu tham khảo Loại Chi tiết
6. Lesson: JDBC Basics (The Java TM Tutorials &gt; JDBC Database Access) [W.W.W. Document], n.d. URL https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html (accessed 5.3.23) Sách, tạp chí
Tiêu đề: TM" Tutorials > JDBC Database Access) [W.W.W
1. 1NF, 2NF, 3NF and BCNF in Database Normalization | Studytonight [WWW Document], n.d. URL https://www.studytonight.com/dbms/database-normalization.php (accessed 5.3.23) Link
2. Add a Salt with the SQL Server HASHBYTES Function [W.W.W. Document], n.d. URL https://www.mssqltips.com/sqlservertip/3293/add-a-salt-with-the-sql-server-hashbytes-function/ (accessed 5.3.23) Link
3. Depression [W.W.W. Document], n.d. URL https://www.who.int/news-room/fact-sheets/detail/depression (accessed 2.27.23) Link
4. FREE Mental Health Tests, Quizzes, Self-Assessments, &amp; Screening Tools [W.W.W. Document], 2022. URL https://www.psycom.net/quizzes (accessed 2.26.23) Link
5. How to check if ResultSet is empty in JDBC Java - Example Tutorial [W.W.W. Document], n.d. URL https://javarevisited.blogspot.com/2016/10/how-to-check-if-resultset-is-empty-in-Java-JDBC.html#axzz80XaDldWk (accessed 5.3.23) Link
7. Ltd, R.G.S., n.d. Free Online SQL Formatter [W.W.W. Document]. URL https://www.red- gate.com/website/sql-formatter (accessed 5.3.23) Link
8. SQL Tutorial [W.W.W. Document], n.d. URL https://www.w3schools.com/sql/ (accessed 5.3.23) Link
9. Suicide mortality rate (per 100,000 population) | Data [W.W.W. Document], n.d. URL https://data.worldbank.org/indicator/SH.STA.SUIC.P5 (accessed 5.3.23) Link
10. SwingWorker (Java Platform S.E. 8 ) [W.W.W. Document], n.d. URL https://docs.oracle.com/javase/8/docs/api/javax/swing/SwingWorker.html (accessed 5.3.23) Link