-
Notifications
You must be signed in to change notification settings - Fork 13
GSoC2018 report generator #1
base: master
Are you sure you want to change the base?
Changes from 2 commits
7c71034
3db8a1b
b62f74a
ff73094
eae3984
2fc50a5
84cb384
2e6ac8d
33fc9c7
8536b8a
8d4896c
eae851d
877388b
b1cb778
780e21a
8e281b5
83de3ee
6b70601
c932ea5
4558a47
29bbb2b
00a4f22
bc024c6
7f33e3f
ecc9ebc
2320022
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | ||
SET time_zone = "+00:00"; | ||
-- | ||
-- Use this file to seed the Report generator for now. | ||
-- | ||
-- Database: `librereportgenerator` | ||
-- | ||
-- -------------------------------------------------------- | ||
-- | ||
-- Dumping data for table `draggable_components` | ||
-- | ||
INSERT INTO `draggable_components` (`id`, `option_id`, `is_default`, `user`, `title`, `order`, `active`, `notes`, `toggle_sort`, `toggle_display`, `created_at`, `updated_at`) VALUES | ||
(1, 'pfullname', 1, 'default', 'Patient Fullname', 5, 1, 'patient_data:fname|mname|lname', 0, 0, NULL, NULL), | ||
(2, 'plfname', 1, 'default', 'Patient Last Firstname', 10, 1, 'patient_data:lname|fname', 0, 0, NULL, NULL), | ||
(3, 'pflname', 1, 'default', 'Patient First Lastname', 15, 1, 'patient_data:fname|lname', 0, 0, NULL, NULL), | ||
(4, 'preversedname', 1, 'default', 'Patient Full reversed name', 20, 1, 'patient_data:lname|mname|fname', 0, 0, NULL, NULL), | ||
(5, 'pfmname', 1, 'default', 'Patient First Middlename', 25, 1, 'patient_data:fname|mname', 0, 0, NULL, NULL), | ||
(6, 'pid', 1, 'default', 'Patient Id', 30, 1, 'patient_data:id', 0, 0, NULL, NULL), | ||
(7, 'pstreet', 1, 'default', 'Patient Street', 35, 1, 'patient_data:street', 0, 0, NULL, NULL), | ||
(8, 'pcity', 1, 'default', 'Patient First Lastname', 40, 1, 'patient_data:city', 0, 0, NULL, NULL), | ||
(9, 'pstate', 1, 'default', 'Patient Full reversed name', 45, 1, 'patient_data:lname|mname|fname', 0, 0, NULL, NULL), | ||
(10, 'pstreetcity', 1, 'default', 'Patient Street City', 50, 1, 'patient_data:street|city', 0, 0, NULL, NULL), | ||
(11, 'pcitystate', 1, 'default', 'Patient City State', 55, 1, 'patient_data:city|state', 0, 0, NULL, NULL), | ||
(12, 'pstreetcitystate', 1, 'default', 'Patient Street City State', 60, 1, 'patient_data:street|city|state', 0, 0, NULL, NULL), | ||
(13, 'ppcode', 1, 'default', 'Patient Postal Code', 65, 1, 'patient_data:postal_code', 0, 0, NULL, NULL), | ||
(14, 'poccupation', 1, 'default', 'Patient Occupation', 70, 1, 'patient_data:occupation', 0, 0, NULL, NULL), | ||
(15, 'pemail', 1, 'default', 'Patient Email', 75, 1, 'patient_data:email', 0, 0, NULL, NULL), | ||
(16, 'pphone', 1, 'default', 'Patient Phone Contact', 80, 1, 'patient_data:phone_contact', 0, 0, NULL, NULL), | ||
(17, 'planguage', 1, 'default', 'Patient Language', 85, 1, 'patient_data:language', 0, 0, NULL, NULL), | ||
(18, 'pregdate', 1, 'default', 'Patient Register date', 90, 1, 'patient_data:regdate', 0, 0, NULL, NULL), | ||
(19, 'psex', 1, 'default', 'Patient Sex', 95, 1, 'patient_data:sex', 0, 0, NULL, NULL), | ||
(20, 'pemailphone', 1, 'default', 'Patient Email Phone', 100, 1, 'patient_data:email|phone_contact', 0, 0, NULL, NULL), | ||
(21, 'pidfullname', 1, 'default', 'Patient PID Fullname', 105, 1, 'patient_data:id|fname|mname|lname', 0, 0, NULL, NULL), | ||
(22, 'pdob', 1, 'default', 'Patient Date of birth', 110, 1, 'patient_data:DOB', 0, 0, NULL, NULL), | ||
(23, 'pss', 1, 'default', 'Patient SS', 115, 1, 'patient_data:ss', 0, 0, NULL, NULL), | ||
(24, 'pstatus', 1, 'default', 'Patient Status', 120, 1, 'patient_data:status', 0, 0, NULL, NULL), | ||
(25, 'preferrer', 1, 'default', 'Patient Referrer', 125, 1, 'patient_data:referrer', 0, 0, NULL, NULL), | ||
(26, 'pstatussex', 1, 'default', 'Patient Status Sex', 130, 1, 'patient_data:status|sex', 0, 0, NULL, NULL), | ||
(27, 'pidnamecontact', 1, 'default', 'Patient ID Name Contact', 135, 1, 'patient_data:id|fname|mname|phone_contact|email', 0, 0, NULL, NULL), | ||
(28, 'pidnameAddress', 1, 'default', 'Patient ID Name Address', 140, 1, 'patient_data:id|fname|mname|street|city|state|postal_code', 0, 0, NULL, NULL), | ||
(29, 'poccupationmonthlyincome', 1, 'default', 'Patient Occupation Monthly Income', 145, 1, 'patient_data:occupation|monthly_income', 0, 0, NULL, NULL), | ||
(30, 'psexstatusfamilysize', 1, 'default', 'Patient Sex Status Family Size', 150, 1, 'patient_data:sex|status|family_size', 0, 0, NULL, NULL); | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Dumping data for table `report_formats` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take dump of whole database. What if user do not run migrations or somehow migration fails? He/she do not know your table structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took these when I had no entries for report_formats, and system features in the database. I'll populate those tables with some entries and dump again! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant that you are taking dump of one table There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I export the entire database, then it'll have CREATE TABLE xyz, and migration command takes care of creating tables. |
||
-- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
<?php | ||
/** | ||
* This file creates draggable_components for the report-generator. | ||
* This is close to the list_options table, but this one if for the report generator module. | ||
* | ||
* TODO Link this table to users table in order to keep track of user adding or editing a component. | ||
* | ||
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]> | ||
*/ | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
@@ -8,10 +16,6 @@ class CreateDraggableComponentsTable extends Migration | |
{ | ||
/** | ||
* Run the migrations. | ||
* This file creates draggable_components for the report-generator. | ||
* This is close to the list_options table, but this one if for the report generator module. | ||
* | ||
* TODO Link this table to users table in order to keep track of user adding or editing a component. | ||
* | ||
* @author Tigpezeghe Rodrige K. <[email protected]> (2018) | ||
* | ||
|
@@ -27,7 +31,7 @@ public function up() | |
$table->string('title', 255)->comment = "This is the text on the component that end users see."; | ||
$table->integer('order', 0)->comment = "The order in which components appear in the list."; | ||
$table->boolean('active')->default(1)->comment = "0 -> False, 1 -> True whether the component should be active or not."; | ||
$table->json('notes', 255)->comment = "This stores the fields that the component relates to in the database."; | ||
$table->string('notes', 1000)->comment = "This stores the fields that the component relates to in the database."; | ||
$table->boolean('toggle_sort')->default(0)->comment = "0 -> False (Descending), 1 -> True (Ascending)."; | ||
$table->boolean('toggle_display')->default(0)->comment = "0 -> False, 1 -> True. Display field if checked (1), and no if unchecked (0)."; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* This file creates draggable_components for the report-generator. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be "This file created report_format for report-generator." . Just a guess. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked! |
||
* This is close to the list_options table, but this one if for the report generator module. | ||
* | ||
* TODO Link this table to users table in order to keep track of user adding or editing a component. | ||
* | ||
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]> | ||
*/ | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
@@ -8,10 +15,6 @@ class CreateReportFormatsTable extends Migration | |
{ | ||
/** | ||
* Run the migrations. | ||
* This file creates draggable_components for the report-generator. | ||
* This is close to the list_options table, but this one if for the report generator module. | ||
* | ||
* TODO Link this table to users table in order to keep track of user adding or editing a component. | ||
* | ||
* @author Tigpezeghe Rodrige K. <[email protected]> (2018) | ||
* | ||
|
@@ -25,7 +28,7 @@ public function up() | |
$table->string('title', 255)->comment = "This is the report name e.g Patient List."; | ||
$table->string('system_feature', 255)->comment = "The system feature under which the report belongs."; | ||
$table->text('description')->comment = "This describes the report format briefly."; | ||
$table->json('draggable_components_id')->comment = "This stores the id of all the components that belong to this report format"; | ||
//$table->string('draggable_components_id', 1000)->comment = "This stores the id of all the components that belong to this report format"; | ||
|
||
$table->timestamps(); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume these names are for WIP versioning for now, or are they intended to serve in a meaningful way to version components later? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aethelwulffe that's the Laravel convention. I am trying to make the table names as obvious as possible. |
||
/** | ||
* This file creates a join or junction table between Report formats and Draggable components. | ||
* This table is used to handle the many-to-many relationship between both tables. | ||
* | ||
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]> | ||
*/ | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateDraggableComponentReportFormatTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @author Tigpezeghe Rodrige K. <[email protected]> (2018) | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::connection('mysql_report_generator')->create('draggable_component_report_format', function (Blueprint $table) { | ||
$table->increments('id')->comment = "Primary key."; | ||
$table->integer('draggable_component_id')->unsigned()->comment = "Used to access the draggable_components."; | ||
$table->foreign('draggable_component_id')->references('id')->on('draggable_components'); | ||
$table->integer('report_format_id')->unsigned()->comment = "Ussed to access the report_formats."; | ||
$table->foreign('report_format_id')->references('id')->on('report_formats'); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be something, that what happens if it is deleted. Like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checked! |
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('draggable_component_report_format'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
namespace Modules\ReportGenerator\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Modules\ReportGenerator\Entities\ReportFormat as ReportFormat; | ||
|
||
class DraggableComponent extends Model | ||
{ | ||
|
@@ -32,4 +33,14 @@ class DraggableComponent extends Model | |
* @var string | ||
*/ | ||
protected $connection = 'mysql_report_generator'; | ||
|
||
/** | ||
* The report formats that belong to the Draggable component. | ||
* | ||
* @return Response | ||
*/ | ||
public function report_formats() | ||
{ | ||
return $this->belongsToMany('ReportFormat')->withTimestamps(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the naming convention for many-to-one, one-to-many elements. Nice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the beauty of Laravel! |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
<?php | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Report generator controller. | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This is the main controller for this report generator module. | ||
| Copyright 2018 Tigpezeghe Rodrige K. <[email protected]> | ||
| | ||
*/ | ||
|
||
namespace Modules\ReportGenerator\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
use Illuminate\Routing\Controller; | ||
|
||
use Modules\ReportGenerator\Entities\DraggableComponent as DraggableComponent; | ||
|
||
class ReportGeneratorController extends Controller | ||
{ | ||
/** | ||
|
@@ -14,7 +25,16 @@ class ReportGeneratorController extends Controller | |
*/ | ||
public function index() | ||
{ | ||
return view('reportgenerator::index'); | ||
$draggableComponents = DraggableComponent::all(); | ||
|
||
return view('reportgenerator::index')->with('draggableComponents', $draggableComponents); | ||
|
||
/* foreach ($draggableComponents as $draggableComponent) { | ||
print_r($draggableComponent->title); | ||
echo '<br>'; | ||
} | ||
|
||
return view('reportgenerator::index'); */ | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ | |
</div> | ||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> | ||
<div class="card-body" id="second"> | ||
<p class="note">Why am I stil empty?</p> | ||
<p class="note">Why am I still empty?</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel the same way. 😸 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is my still empty? 🍷 |
||
</div> | ||
</div> | ||
</div> | ||
|
@@ -96,31 +96,14 @@ | |
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> | ||
<div class="card-body"> | ||
<p class="note">Frequently used columns</p> | ||
<div class="row"> | ||
<div class="col-sm-3" id="draggable"><p>I am one</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am two</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am three</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am four</p></div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-3" id="draggable"><p>I am five</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am six</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am seven</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am eight</p></div> | ||
</div> | ||
<hr /> | ||
<p class="note">All columns that concern reports</p> | ||
<div class="row"> | ||
<div class="col-sm-3" id="draggable"><p>I am one</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am two</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am three</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am four</p></div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-3" id="draggable"><p>I am five</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am six</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am seven</p></div> | ||
<div class="col-sm-3" id="draggable"><p>I am eight</p></div> | ||
<div class="row" id="draggable-column"> | ||
@foreach ($draggableComponents as $draggableComponent) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good use of foreach to write compact code. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foreach is indeed a beautiful construct. One that sometimes leaves me thinking "My code can't work! There isn't enough....CODE!" 😜 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My mentors catch everything!!! |
||
<div class="col-sm-2 wordwrap draggable" id="{{ $draggableComponent->title }}"> | ||
<p data-toggle="tooltip" data-placement="top" title="{{ $draggableComponent->title }}"> | ||
{{ $draggableComponent->title }} | ||
</p> | ||
</div> | ||
@endforeach | ||
</div> | ||
</div> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
text-align: center; | ||
} | ||
|
||
#draggable{ | ||
.draggable{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ID to class? Was that an error correction or just a refactor of the approach? |
||
max-width: 24.5%; | ||
height: 50px; | ||
border: 1px solid lightgrey; | ||
|
@@ -19,3 +19,16 @@ | |
margin-top: -7px; | ||
margin-bottom: -7px; | ||
} | ||
#draggable-column { | ||
/* overflow: auto; */ | ||
height: 500px; | ||
} | ||
|
||
/*Wrap and break the draggable components' titles*/ | ||
.wordwrap { | ||
padding: 3px; | ||
width: 130px; | ||
word-break: break-all; | ||
word-wrap: break-word; | ||
overflow: hidden; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obviously a WIP comment. Making a comment here just so we make sure to check for these when it is final review time.