Skip to content

Commit

Permalink
Merge branch 'development' into timetracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Dansuf authored Apr 17, 2018
2 parents e4cfc22 + 43d7c2a commit ac9679d
Show file tree
Hide file tree
Showing 158 changed files with 170,335 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
APP_NAME="Evidenctio Patient Portal"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

EVIDENCIO_KEY=
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
# 2018-Evidencio

A web applicaction that allows patients to calculate medical predictions based on [Evidencio library](https://www.evidencio.com) models in a user-friendly way.

A more detailed description is available in the Requirements Document under the `docs` folder.




### How to install

Follow the instructions in the [Laravel documentation](https://laravel.com/docs/5.6/installation) to install required dependencies and the Laravel package itself.

Clone the repository and create your own `.env` file by copying `.env.example` and providing necessary data. Please provide Evidencio API key here as well. Then run these commands inside the repository:

composer install
php artisan key:generate

To create the database structure please run the following command:

php artisan migrate

You will also need to run it every time there is a new database migration available.

### How to run

Run the following command:

php artisan serve

### Troubleshooting


#### NOTE: in Windows, this server will run from a command prompt.
If you are using Apache through XAMPP (**maybe** even without XAMPP), you can change the following file:

XAMPP\apache\conf\httpd.conf
(If not through XAMPP, then in the respective apache directory)
Under the DocumentRoot setting in the file, you need to change the line:

C:\xampp\htdocs

into:

yourDirectory\2018-Evidencio\public

where the "2018-Evidencio" is the local repository. This will then be the localhost after running the apache server. Note that this should more preferably be done through virtual hosts, but since it's more complicated, this works as well. The only problem is that you can only run one localhost at a time. The original solution can be found on the address:
[stack overflow link](https://stackoverflow.com/questions/1408/make-xampp-apache-serve-file-outside-of-htdocs/)


In case of any issues with the framework please refer to the [Laravel documentation](https://laravel.com/docs/5.6).
42 changes: 42 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
68 changes: 68 additions & 0 deletions app/EvidencioAPI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

namespace App;

class EvidencioAPI
{
/*
* @return API response converted into a PHP variable.
* @throws JsonDecodeException if JSON response could not be decoded.
* Other possible exceptions are listed in Guzzle's documentation
*/
private static function fetch($path, $params = [])
{
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.evidencio.com/api/']);
$res = $client->post($path,
[
'headers' => [
'Accept' => 'application/json',
'Authorization' => config('app.evidencio_key')
],
'form_params' => $params
]);

$json = json_decode($res->getBody(),true);

if(is_null($json))
{
throw new Exceptions\JsonDecodeException("Could not decode API response to JSON: '".$res->getBody()."'.");
}
return $json;
}

public static function overview()
{
return self::fetch("overview");
}

public static function search($query)
{
return self::fetch("search",["query" => $query]);
}

public static function models()
{
return self::fetch("models");
}

public static function getModel($id)
{
return self::fetch("model",["id" => $id]);
}

/*
* @param $values array of key-value pairs for each variable where id is the key
*/
public static function run($id,$values)
{
foreach ($values as $answers) {
if (is_numeric($answers)) {
$answers = floatval($answers);

}
}
$values["id"] = $id;
return self::fetch("run",$values);
}

}
53 changes: 53 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}
7 changes: 7 additions & 0 deletions app/Exceptions/JsonDecodeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Exceptions;

use Exception;

class JsonDecodeException extends Exception { }
14 changes: 14 additions & 0 deletions app/Field.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Field extends Model
{

public function options()
{
return $this->hasMany('App\Option','categoricalFieldId');
}
}
32 changes: 32 additions & 0 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/

use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
39 changes: 39 additions & 0 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/

use AuthenticatesUsers;

/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/designer';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
Loading

0 comments on commit ac9679d

Please sign in to comment.