-
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 15 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,48 @@ | ||
| 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`, `note`, `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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <?php | ||
| /** | ||
| * This file creates a table for system features, e.g Clients, Financial, Insurance. | ||
| * This table is used to handle the many-to-many relationship between both tables. | ||
| * | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| */ | ||
|
|
||
| use Illuminate\Support\Facades\Schema; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Database\Migrations\Migration; | ||
|
|
||
| class CreateSystemFeaturesTable extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| * | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> (2018) | ||
| * | ||
| * @return void | ||
| */ | ||
| public function up() | ||
| { | ||
| Schema::connection('mysql_report_generator')->create('system_features', function (Blueprint $table) { | ||
| $table->increments('id')->comment = "This will identify each system feature with a unique integer."; | ||
| $table->string('name')->comment = "The name of the system feature."; | ||
| $table->text('description')->comment = "This describes the system feature briefly."; | ||
|
|
||
| $table->timestamps(); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function down() | ||
| { | ||
| Schema::dropIfExists('system_features'); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <?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. | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| */ | ||
|
|
||
| use Illuminate\Support\Facades\Schema; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Database\Migrations\Migration; | ||
|
|
||
| class CreateDraggableComponentsTable extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| * | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> (2018) | ||
| * | ||
| * @return void | ||
| */ | ||
| public function up() | ||
| { | ||
| Schema::connection('mysql_report_generator')->create('draggable_components', function (Blueprint $table) { | ||
| $table->increments('id')->comment = "This will identify each component with a unique integer."; | ||
| $table->string('option_id', 255)->comment = "All draggable components have an ID."; | ||
| $table->boolean('is_default')->default(1)->comment = "0 -> False, 1 -> True."; | ||
| $table->string('user', 255)->default('default')->comment = "The user who created the component. This will be 'default' for components that come with the module."; | ||
| $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->string('note', 255)->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)."; | ||
|
|
||
| $table->timestamps(); | ||
|
|
||
| // $table->foreign('userID')->references('id')->on('users')->onDelete('cascade'); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function down() | ||
| { | ||
| Schema::dropIfExists('draggable_components'); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
| /** | ||
| * This file creates report formats for the report-generator. | ||
| * These report formats are close to system static reports, 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. <tigrodrige@gmail.com> | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| */ | ||
| use Illuminate\Support\Facades\Schema; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Database\Migrations\Migration; | ||
|
|
||
| class CreateReportFormatsTable extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| * | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> (2018) | ||
| * | ||
| * @return void | ||
| */ | ||
| public function up() | ||
| { | ||
| Schema::connection('mysql_report_generator')->create('report_formats', function (Blueprint $table) { | ||
| $table->increments('id')->comment = "This will identify each component with a unique integer."; | ||
| $table->string('user', 255)->default('default')->comment = "The user who created the report format. This will be 'default' for components that come with the module."; | ||
| $table->string('title', 255)->comment = "This is the report name e.g Patient List."; | ||
| $table->text('description')->comment = "This describes the report format briefly."; | ||
| //$table->string('option_ids')->comment = "This stores the option ids of components that constitute this report format"; | ||
| $table->integer('system_feature_id')->unsigned()->comment = "The system feature under which the report belongs."; | ||
| $table->foreign('system_feature_id')->references('id')->on('system_features')->onDelete('cascade'); | ||
| //$table->string('draggable_components_id', 1000)->comment = "This stores the id of all the components that belong to this report format"; | ||
|
|
||
|
|
||
| $table->timestamps(); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function down() | ||
| { | ||
| Schema::dropIfExists('report_formats'); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?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. | ||
| * | ||
| * @author Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| */ | ||
|
|
||
| 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. <tigrodrige@gmail.com> (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')->onDelete('cascade'); | ||
| $table->integer('report_format_id')->unsigned()->comment = "Used to access the report_formats."; | ||
| $table->foreign('report_format_id')->references('id')->on('report_formats')->onDelete('cascade'); | ||
|
|
||
|
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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
|
|
||
| /* Use this to seed draggable_components table. | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| * */ | ||
|
|
||
| namespace Modules\ReportGenerator\Database\Seeders; | ||
|
|
||
| use Illuminate\Database\Seeder; | ||
| use Illuminate\Database\Eloquent\Model; | ||
|
|
||
| class DraggableComponentTableSeeder extends Seeder | ||
| { | ||
| /** | ||
| * Run the database seeds. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function run() | ||
| { | ||
| Model::unguard(); | ||
| factory("../../". Entities\DraggableComponent::class, 25)->create(); | ||
| // $this->call("OthersTableSeeder"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
|
|
||
| /* Use this to seed report_formats table. | ||
| * Copyright 2018 Tigpezeghe Rodrige K. <tigrodrige@gmail.com> | ||
| * */ | ||
|
|
||
| //namespace Modules\ReportGenerator\Database\Seeders; | ||
|
|
||
| use Illuminate\Database\Seeder; | ||
| use Illuminate\Database\Eloquent\Model; | ||
|
|
||
| class ReportFormatTableSeeder extends Seeder | ||
| { | ||
| /** | ||
| * Run the database seeds. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function run() | ||
| { | ||
| Model::unguard(); | ||
| factory(Modules\ReportGenerator\Entities\ReportFormat::class, 25)->create(); | ||
| // $this->call("OthersTableSeeder"); | ||
| } | ||
| } |
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.