This repository holds the source code for the frontend and backend of a clinic application that allows user to check a clinic's consultation records.
To use the app,
- clone the repository to a local folder
- move to the
TestServer
directory - enter
npm install
andnpm start
- open a new terminal, enter
npm run tunnel
(we use ngrok so the react native app in development mode can connect to the local server) - copy the first 12 letters of the displayed ngrok url (e.g.
cf8edc7c198c
forhttp://cf8edc7c198c.ngrok.io
)
replace the value ofTUNNEL_ADDRESS
in the/src/helpers/api.js
file with it - open a new terminal, go to root directory, enter
npm install
and enterexpo start
The backend REST API supports the following http requests,
-
post
/register
The body is a JSON object with the following keys:email, password
-
post
/login
The body is a JSON object with the following keys:email, password, clinicName, phone, address
-
post
/consults
(for adding one new consultation record)
Authentication required(the clinic info is extracted from the jwt token).
The header has to contain a Authorization key with value of the formBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImxvbEB3aGF0ZXZlci5jb20iLCJpYXQiOjE2MTkxNzM5NDh9.MF52yBEfuWu1SsaGXI2ib0q9blsduvRNTyT2yVHa4N8
The body is a JSON object with the following keys:doctorName, patientName, diagnosis, medication, fee, datetime, followup
-
get
/consults/:consultID
Authentication required(you can request for only the records belonging to this clinic). -
get
/consults
e.g. get/consults?year=2021&month=4&day=22&dayCount=10
It returns a sorted list of records belonging to this clinic that occured within the first 10 days after2021-4-22
(inclusive)
Authentication required.
- Demo of clinic app
The part where the UI is not responding is due to the fact that ngrok(free plan) has a per minute connection limitation(40 max). This won't happen in production. On th detail page, doctor name is missing, the bug was already fixed after recording of the video. - Demo of login/register form validation
Some features have been considered but were not implemented due to time restrictions.
- Send login/register info over https
- Add user input feedback for the monthly view UI
- Cache data locally to reduce latency and save bandwidth
- Add input validation for the REST API
- Add a drawer to show the clinic info and a logout button
- Add a page for adding a new entry of consultation record
- Use react hook form for form validation
React native, react-navigation, react-native-chart-kit, react-native-calendar-strip, react-native-datepicker, axios, node, express, knex, MySQL(hosted on Amazon RDS), bcrypt, jsonwebtoken, moment