Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pull request #13 from mHealthKenya/srl #14

Open
wants to merge 54 commits into
base: srl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d7c4c2c
Merge pull request #13 from mHealthKenya/srl
CynthiaKamau Apr 21, 2021
82674c1
Update DataController.php
CynthiaKamau Apr 22, 2021
b8e39bc
terms for app
cbrianbet Apr 22, 2021
afda315
Update TermsController.php
cbrianbet Apr 22, 2021
2b96494
Update TermsController.php
cbrianbet Apr 22, 2021
9d191fb
Update highcharts_dashboard.blade.php
CynthiaKamau May 12, 2021
ee9b490
bug fix
CynthiaKamau Aug 19, 2021
5712ca4
Update ILFacilityController.php
CynthiaKamau Aug 19, 2021
27981d7
Uncommented srl header links
CynthiaKamau Aug 31, 2021
598decf
Update .env.example
CynthiaKamau Sep 2, 2021
3666853
Delete .env.save
CynthiaKamau Sep 2, 2021
9e97ea8
Delete ..env.swp
CynthiaKamau Sep 2, 2021
c03da2a
Create README.md
CynthiaKamau Sep 2, 2021
3e359dc
Update README.md
CynthiaKamau Sep 2, 2021
56ee895
updated readme
CynthiaKamau Sep 2, 2021
48d16c3
Create LICENSE.md
CynthiaKamau Sep 6, 2021
0fc49f2
Update LICENSE.md
CynthiaKamau Sep 6, 2021
83a6095
added migrations
CynthiaKamau Sep 7, 2021
cf9f5f9
Update SmsGatewayController.php
CynthiaKamau Oct 19, 2021
b3d3fe5
Update SmsGatewayController.php
CynthiaKamau Oct 25, 2021
876d357
Update SenderController.php
CynthiaKamau Oct 25, 2021
85f5aab
added ccc validation
CynthiaKamau Nov 19, 2021
9e36c9b
sms partner breakdown
CynthiaKamau Nov 25, 2021
10098ef
super admin reports
CynthiaKamau Nov 26, 2021
d8d1362
perms
Nov 26, 2021
10d0666
rounding up sums
CynthiaKamau Nov 29, 2021
c5bd950
Merge branch 'staging' of https://github.com/palladiumkenya/mLab into…
CynthiaKamau Nov 29, 2021
83c6eb9
sms sum integer
CynthiaKamau Nov 30, 2021
68bc983
added queued sms
CynthiaKamau Jan 5, 2022
c46aae2
bug fix
CynthiaKamau Jan 5, 2022
62131c3
seperated charts
CynthiaKamau Jan 5, 2022
56c7249
Update README.md
CynthiaKamau Jan 17, 2022
d5dfbab
Update README.md
CynthiaKamau Jan 17, 2022
7267f8b
Update README.md
CynthiaKamau Jan 17, 2022
25124d6
Update README.md
CynthiaKamau Jan 17, 2022
cddd0b1
added sms callback reports
CynthiaKamau Jan 20, 2022
3129e9b
updated footer
CynthiaKamau Jan 20, 2022
14e2e63
added county charts
CynthiaKamau Feb 9, 2022
997d348
Include docker setup option
andrineM Mar 10, 2022
d1874da
Update README.md
Lavatsaleo Mar 25, 2022
4e8c24a
add docker setup
Lavatsaleo Mar 25, 2022
0667eda
Update README.md
Lavatsaleo Mar 25, 2022
8782772
Update README.md
Lavatsaleo Apr 7, 2022
b46df37
Merge pull request #1 from palladiumkenya/cicd
Lavatsaleo Apr 7, 2022
b26118d
amend nginx dockerfile
andrineM Apr 19, 2022
aa938b0
Merge pull request #2 from palladiumkenya/cicd
andrineM Apr 19, 2022
2858847
Update README.md
andrineM Apr 21, 2022
3ed0503
Update README.md
andrineM Apr 21, 2022
5266224
Include docker setup
andrineM Apr 21, 2022
4202e48
Merge pull request #3 from palladiumkenya/cicd2
andrineM Apr 21, 2022
f32b6ce
Update README.md
andrineM Apr 21, 2022
8dfe51f
Create cicd_process.yml
Lavatsaleo May 6, 2022
722b130
Merge branch 'master' of https://github.com/palladiumkenya/mLab into …
CynthiaKamau May 17, 2022
90b7467
Merge pull request #20 from palladiumkenya/staging
CynthiaKamau May 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed ..env.swp
Binary file not shown.
Empty file modified .composer.json.swp
100644 → 100755
Empty file.
13 changes: 9 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=pgsql
DB_HOST=41.204.187.154
DB_HOST=
DB_PORT=5432
DB_DATABASE=mlab
DB_USERNAME=medyq_user
DB_PASSWORD=Qw3Rty123!!!
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

SRL_API_KEY='CHAI SAMPLE REMOTE LOGIN API KEY'
VL_RESULTS='CHAI RESULTS KEY'
AT_KEY='SMS KEY'
AT_SMSGT='SMS GATEWAY KEY'

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
35 changes: 0 additions & 35 deletions .env.save

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/cicd_process.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: deploy to test
on:
push:
branches: [ cicd ]
jobs:

build:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: executing remote connection
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.MLAB_HOST }}
username: ${{ secrets.MLAB_HOST_USERNAME }}
key: ${{ secrets.CICD_SECRET }}
port: ${{ secrets.MLAB_HOST_PORT }}
script: |
git config --global --add safe.directory /apps/github-workflows/mLab
cd /apps/github-workflows/mLab
git pull origin cicd
git status

sudo cp -R /apps/dockerApps/mlabtestsite/nginx /apps/github-workflows/mLab

docker-compose down
docker-compose up -d
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 mHealth Kenya

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
156 changes: 156 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<p align="center">
<a href="https://mlab.palladiumkenya.co.ke">
<img src="https://mlab.mhealthkenya.co.ke/assets/images/logo.png" alt="mLab">
</a>
</p>

# mLab Dashboard and API's

### Features

mLab has the following modules: <br>
Patient results: this module allows for client appointment management and client enrollment. <br>
Sub-functions in this module include: <br>
-Sample remote login: for allowing login of samples into the system for the samples being sent to the labs <br>
-HTS results transmission: for HIV results for non – conclusive tests <br>
-Client messaging: for consent and message of clients on results availability to enhance linkage to care <br>

## Installation

Please check the official laravel installation guide for server requirements before you start. [Official Documentation](https://laravel.com/docs/5.8/installation#installation)

Alternative installation is possible without local dependencies relying on [Docker](#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](#environment-variables)

php artisan migrate
php artisan serve


## Docker set up

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

## Dependencies

- [laravel-passport](https://github.com/laravel/passport) - For handling authentication
- [laravel-cors](https://github.com/barryvdh/laravel-cors) - For handling Cross-Origin Resource Sharing (CORS)
- [africastalking](https://github.com/AfricasTalkingLtd/africastalking-php) - For SMS


## Folders

- `app` - Contains all the Eloquent models
- `app/Http/Controllers` - Contains all the api controllers
- `app/Http/Middleware` - Contains the JWT auth middleware
- `app/Http/Controllers/VLResultsController.php` - Contains the functions implementing the vl and eid results module
- `app/Http/Controllers/HTSResultsController.php` - Contains the functions implementing the hts results module
- `app/Http/Controllers/RemoteLoginController.php` - Contains the functions implementing the sample remote login module
- `app/Http/Controllers/SendResultsController.php` - Contains the functions implementing the sending of results via the mobile application
- `app/Http/Controllers/TBResultsController.php` - Contains the functions implementing the TB results module
- `app/Http/Controllers/DataController.php` - Contains the functions and queries for the highcharts
- `config` - Contains all the application configuration files
- `database/factories` - Contains the model factory for all the models
- `database/migrations` - Contains all the database migrations
- `routes/api` - Contains all the api routes
- `routes/web` - Contains all the dashboard routes
- `tests` - Contains all the application tests

## Environment variables

- `.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.

----------

# Testing API

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](#api-specification) for more info.

----------

# Authentication

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.

- https://github.com/laravel/passport/

----------

# Cross-Origin Resource Sharing (CORS)

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
## Dependencies

- [laravel-cors](https://github.com/barryvdh/laravel-cors) - For handling Cross-Origin Resource Sharing (CORS)

## License

[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge)](#)

[![Open Source Love](https://badges.frapsoft.com/os/v2/open-source-200x33.png?v=103)](#)
15 changes: 15 additions & 0 deletions app/BlackListUsers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class BlackListUsers extends Model
{
public $table = 'blacklist_users';
public $timestamps = false;

protected $fillable = [
'id', 'phone_number'
];
}
Empty file modified app/Dashboard.php
100644 → 100755
Empty file.
Empty file modified app/Http/Controllers/DashboardController.php
100644 → 100755
Empty file.
18 changes: 9 additions & 9 deletions app/Http/Controllers/DataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ public function vl_srl_results(Request $request)
$results->where('partner', $partner->name);
}
if (!empty($request->county_id)) {
$partner = County::find($request->county_id);
$county = County::find($request->county_id);
$results->where('county', $county->name);
}
if (!empty($request->sub_county_id)) {
$partner = SubCounty::find($request->sub_county_id);
$results->where('partner', $sub_county->name);
$sub_county = SubCounty::find($request->sub_county_id);
$results->where('sub_county', $sub_county->name);
}
if (!empty($request->code)) {
$facility = Facility::where('code', $request->code)->first();
Expand Down Expand Up @@ -233,12 +233,12 @@ public function eid_srl_results(Request $request)
$results->where('partner', $partner->name);
}
if (!empty($request->county_id)) {
$partner = County::find($request->county_id);
$county = County::find($request->county_id);
$results->where('county', $county->name);
}
if (!empty($request->sub_county_id)) {
$partner = SubCounty::find($request->sub_county_id);
$results->where('partner', $sub_county->name);
$sub_county = SubCounty::find($request->sub_county_id);
$results->where('sub_county', $sub_county->name);
}
if (!empty($request->code)) {
$facility = Facility::where('code', $request->code)->first();
Expand Down Expand Up @@ -293,12 +293,12 @@ public function hts_srl_results(Request $request)
$results->where('partner', $partner->name);
}
if (!empty($request->county_id)) {
$partner = County::find($request->county_id);
$county = County::find($request->county_id);
$results->where('county', $county->name);
}
if (!empty($request->sub_county_id)) {
$partner = SubCounty::find($request->sub_county_id);
$results->where('partner', $sub_county->name);
$sub_county = SubCounty::find($request->sub_county_id);
$results->where('sub_county', $sub_county->name);
}
if (!empty($request->code)) {
$facility = Facility::where('code', $request->code)->first();
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/ILFacilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public function addilfacility(Request $request)
} else {
$facility->phone_no = $request->code;
}
$facility->internet = $request->internet;
if(!empty($request->internet)) {
$facility->internet = $request->internet;
} else {
$facility->internet = 'Yes';
}

if ($facility->save()) {
toastr()->success('IL Facility has been saved successfully!');
Expand Down
Empty file modified app/Http/Controllers/NewRemoteLoginController.php
100644 → 100755
Empty file.
Loading