mLab has the following modules:
Patient results: this module allows for client appointment management and client enrollment.
Sub-functions in this module include:
-Sample remote login: for allowing login of samples into the system for the samples being sent to the labs
-HTS results transmission: for HIV results for non – conclusive tests
-Client messaging: for consent and message of clients on results availability to enhance linkage to care
Please check the official laravel installation guide for server requirements before you start. Official Documentation
Alternative installation is possible without local dependencies relying on Docker.
Clone the repository
git clone https://github.com/palladiumkenya/mLab.git
Switch to the repo folder
cd mLab
Install all the dependencies using composer
composer install
Copy the example env file and make the required configuration changes in the .env file
cp .env.example .env
Generate a new application key
php artisan key:generate
Run the database migrations (Set the database connection in .env before migrating)
php artisan migrate
Start the local development server
php artisan serve
You can now access the server at http://localhost:8000
TL;DR command list
git clone https://github.com/palladiumkenya/mLab.git
cd mLab
composer install
cp .env.example .env
php artisan key:generate
Make sure you set the correct database connection information before running the migrations Environment variables
php artisan migrate
php artisan serve
git clone https://github.com/palladiumkenya/mLab.git
cd mLab
cp .env.example .env
mkdir src
copy all files into src folder (excluding docker-compose.yml,nginx.dockerfile,php.dockerfile and nginx folder)
docker-compose --env-file ./src/.env up -d --build site
You can now access the server at http://localhost:8085
- laravel-passport - For handling authentication
- laravel-cors - For handling Cross-Origin Resource Sharing (CORS)
- africastalking - For SMS
app
- Contains all the Eloquent modelsapp/Http/Controllers
- Contains all the api controllersapp/Http/Middleware
- Contains the JWT auth middlewareapp/Http/Controllers/VLResultsController.php
- Contains the functions implementing the vl and eid results moduleapp/Http/Controllers/HTSResultsController.php
- Contains the functions implementing the hts results moduleapp/Http/Controllers/RemoteLoginController.php
- Contains the functions implementing the sample remote login moduleapp/Http/Controllers/SendResultsController.php
- Contains the functions implementing the sending of results via the mobile applicationapp/Http/Controllers/TBResultsController.php
- Contains the functions implementing the TB results moduleapp/Http/Controllers/DataController.php
- Contains the functions and queries for the highchartsconfig
- Contains all the application configuration filesdatabase/factories
- Contains the model factory for all the modelsdatabase/migrations
- Contains all the database migrationsroutes/api
- Contains all the api routesroutes/web
- Contains all the dashboard routestests
- Contains all the application tests
.env
- Environment variables can be set in this file
Note : You can quickly set the database information and other variables in this file and have the application fully working.
Run the laravel development server
php artisan serve
The api can now be accessed at
http://localhost:8000/api
Request headers
Required | Key | Value |
---|---|---|
Yes | Content-Type | application/json |
Yes | X-Requested-With | XMLHttpRequest |
Optional | Authorization | Token {JWT} |
Refer the api specification for more info.
This applications uses Passport to handle authentication. The token is passed with each request using the Authorization
header with Token
scheme. The Passport authentication middleware handles the validation and authentication of the token. Please check the following sources to learn more about JWT.
This applications has CORS enabled by default on all API endpoints. The default configuration allows requests from http://localhost:3000
and http://localhost:4200
to help speed up your frontend testing. The CORS allowed origins can be changed by setting them in the config file. Please check the following sources to learn more about CORS.
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
- https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
- https://www.w3.org/TR/cors
- laravel-cors - For handling Cross-Origin Resource Sharing (CORS)