- svs-paediatric-delerium
This is the final year project for the SvS team. Currently the project consists of a prototype Audit system which will display compliance data for delerium treatment within PICUs across the UK & ROI.
The problem that required this system is that paediatric ICUs had no modern and convenient way to record data regarding patients experiencing delirium. The approach taken was one of modernisation and simplification to assist the ICUs. This was done using software engineering techniques to aid in development and create a system that improved on the previous one. This work will greatly aid the nurses in paediatric ICUs in their process of recording the Audit data.
Only Docker is specifically required to run the project, but Postgres and Node.Js is required if the application is to be ran without the use of Docker.
- Docker v4.25.2
- docker-compose v2.20.3
- Node.Js vv20.10.0, required to generate the documentation
A start-up script is used to start the application. There is both a .ps1
version, for window machines, and a .sh
, for linux machines.
To allow powershell scripts to run on you machine, please follow the instructions within the PowerShell set up section.
Please see the commands below to start the application
./start-docker.ps1
If you wish to use the powershell
script you may need to run the following command with administrator access, within the powershell application.
Set-ExecutionPolicy RemoteSigned
./start-docker.sh
The will delete the existing database volume for this project before starting the project to allow the database to be re-initialised.
The following arguments can be supplied to each script
-b
- Executes in the background
-c
- Deletes all containers and volumes related to the document
-n
- Deletes all project images along with containers and volumes
-p
- Starts the production environment, if in a Linux environment and the
.sh
script is used this also sets cronjobs for the backup along with the rolling delete of the log data.
- Starts the production environment, if in a Linux environment and the
-d
- Creates a dump of the database
-startcron
- Begins a crontab daemon that will dump the database at midnight everyday
-stopcron
- Stops the crontab daemon
-r c
- Restores the child dump.
-r f
- Restores the father dump.
-r g
- Restores the grandfather dump.
The docker daemon must be running.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
The backend needs to have a postgres sever with the.
More about the frontend and the backend can be found in their respective README.md
‘s.
If the database-set-up.sh
file is causing errors, when starting the docker container, stop the container and run the commands below, within a bash terminal. Once this is done, then attempt to run the container again. See the stackoverflow answer here.
vi database-set-up.sh
:set ff=unix
:wq
If you would like to change the setup of the database alter the .sql
files within the relevant database folder within the sql
folder.
- Docker: These files are stored within the main directory of the project, which includes:
- The
docker-compose
files for both the development and production environments - The required
database-set-up.sh
script which is used to build the database- This script requires the existance of the
./sql
folder, and it’s subfolders
- This script requires the existance of the
- The
- PgAmin4: The relevant files to set up the Postgres server with PgAdmin4 are within the
./pgadmin4
folder and more can be learnt here - Startup Scripts: Both these scripts reside in the main directory
- Backend: Stored within the
./APIs
folder- A specific README for the backend can be found at
./APIs/README.MD
- The main code of the project can be found in
./APIs/src
- The automated tests can be found in
./APIs/tests
- When the commands
npm install
&npm run docs
is executed within the./APIs
directory:- The site can be viewed by opening
./APIs/docs/site/index.html
in a web browser - Markdown files can be viewed within the folder
./APIs/docs/markdown
- The site can be viewed by opening
- A specific README for the backend can be found at
- Frontend: Stored within the
./Audit
folder- A specific README for the backend can be found at
./Audit/README.MD
- When the command
npm install
&npm run docs
is executed within the./Audit
directory:- The site can be viewed by opening
./Audit/docs/site/index.html
in a web browser - Markdown files can be viewed within the folder
./Audit/docs/markdown
- The site can be viewed by opening
- Custom components made for the application can be found at
./Audit/src/components
- The pages of the site can be found in
./Audit/src/pages
- The entry point of the applications is the
./Audit/src/index.tsx
files - The routing can be found in
./Audit/src/AppRouter.tsx
- Images, used for the site can be found in
./Audit/src/assets/images
- A specific README for the backend can be found at
- Database:
- The
.sql
files that build the database belong in thesql
file- Each subfolder represents a separate database and these folders contain the
.sql
files
- Each subfolder represents a separate database and these folders contain the
- The
To access the database once the container is running use the below command where {dev|prod}
depends if the development or production environment is running.
docker exec -it {dev|prod}_svs_postgres psql -U postgres
The instructions here were followed to set up pgAdmin4. This is only available within the development environment.
The instructions below must be repeated every time the project is launched.
-
Go to http://localhost:5050/, the page may take a while to load
-
Enter in the following details
- username = admin@admin.com
- password = root
-
Select the server named
dev-svs-postgres-server
and enter the passwordpostgrespw
Alternatively to step 3, you can add the server manually following the steps below:
-
Select ‘Add New Server’
-
Enter any name you would like for the server to be called
-
Select the ‘Connection’ tab and enter the below details, the default values for the other fields mentioned below should be left
- Host name/address = svs_postgres
- Username = postgres
- Password = postgrespw
- Within the side panel go to serverName -> Databases -> databaseName -> Schemas -> public -> Tables
- Replace ‘severName’ with the name given to the server in step 4 within the Access section
- Replace ‘databaseName’ with the specific name of the database in which the tables are contained in
- To view the data within the table right click the table name and select ‘View/Edit Data’
Within the ./APIs/src/index.ts
, at the bottom of the file.
Ensure the below code is uncommented:
https.createServer(options, app)
.listen(port, () => {
console.log(`listen port ${port}`);
console.log(`Go to https://${baseIP}:${port}/swagger-docs for documentation`);
});
Ensure the below code is commented out:
app.listen(port,()=> {
console.log(`listen port ${port}`);
console.log(`Go to http://${baseIP}:${port}/swagger-docs for documentation`);
});
Ensure your own ./APIs/server.cert
and ./APIs/server.key
is used.
As traffic is encrypted, there is no practical need for the Caesar cipher used, although the application will still work with this.
If you would like to remove this it can be done by replacing the ./login
endpoint definition with the below:
app.post("/login", (request: Request, response: Response, next:NextFunction) => authenticate);
Then the configuration, when calling the ./login
endpoint within ./Audit/src/pages/SignIn/SignIn.tsx
can be changed to the below:
const loginConfig = {
method: "post",
url: `${process.env.REACT_APP_API_URL}/login`,
data: {
username: username,
password: password,
}
};
The ceaserCipherr
method can then be removed from this file, if so wished.
Leave a Reply