Skip to content
This repository was archived by the owner on May 10, 2022. It is now read-only.

GSoC2018 report generator #1

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7c71034
Adding migrations and models for report generator tables
Trodrige May 26, 2018
3db8a1b
An attempt to add Factories and seeders for the report generator. Add…
Trodrige May 28, 2018
b62f74a
Added the junction table for report format and draggable component re…
Trodrige Jun 4, 2018
ff73094
display draggable components
Trodrige Jun 6, 2018
eae3984
Getting the option IDs of selected components
Jun 11, 2018
2fc50a5
Sending CSRF header and getting response from controller
Jun 12, 2018
84cb384
corrected previous PR. Added command to create two laravel-ehr databases
Trodrige Jun 14, 2018
2e6ac8d
An attempt to get data from selected columns, and send to views
Trodrige Jun 17, 2018
33fc9c7
Attempt to retrieve data
Trodrige Jun 22, 2018
8536b8a
cleaned showReport function, and sending data to view
Trodrige Jun 23, 2018
8d4896c
attempt to display rendered data in the view
Trodrige Jun 23, 2018
eae851d
Displaying rendered data
Trodrige Jun 25, 2018
877388b
Add new system feature
Trodrige Jul 1, 2018
b1cb778
Adding ability to save report format. Adding entries to join table
Trodrige Jul 2, 2018
780e21a
Updating instruction.txt to show Libre EHR Db configurations
Trodrige Jul 2, 2018
8e281b5
Merging install and instruction files in README file
Trodrige Jul 5, 2018
83de3ee
dumping test data for features and report formats
Trodrige Jul 5, 2018
6b70601
updating and deleting system features
Trodrige Jul 16, 2018
c932ea5
Delete report format
Trodrige Jul 16, 2018
4558a47
Edit report format title and description
Trodrige Jul 20, 2018
29bbb2b
View existing report from selected report format
Trodrige Jul 20, 2018
00a4f22
hiding save report format button when showing existing report
Trodrige Jul 23, 2018
bc024c6
Adding pdf_report.php for PDF generation function
Trodrige Jul 27, 2018
7f33e3f
sending for columns for use in pdf generation
Trodrige Jul 28, 2018
ecc9ebc
keeping all draggable components in drop box and draggable pool.
Trodrige Aug 3, 2018
2320022
--amend
Trodrige Aug 3, 2018
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
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

DB_REPORT_GENERATOR_CONNECTION=mysql_report_generator
DB_REPORT_GENERATOR_HOST=127.0.0.1
DB_REPORT_GENERATOR_PORT=3306
DB_REPORT_GENERATOR_DATABASE=homestead
DB_REPORT_GENERATOR_USERNAME=homestead
DB_REPORT_GENERATOR_PASSWORD=secret

DB_LIBREEHR_CONNECTION=mysql_libreehr
DB_LIBREEHR_HOST=127.0.0.1
DB_LIBREEHR_PORT=3306
DB_LIBREEHR_DATABASE=homestead
DB_LIBREEHR_USERNAME=homestead
DB_LIBREEHR_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
Expand Down
25 changes: 0 additions & 25 deletions Documentation/install.txt

This file was deleted.

67 changes: 0 additions & 67 deletions Documentation/instructions.txt

This file was deleted.

94 changes: 94 additions & 0 deletions Documentation/librereportgenerator.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

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

INSERT INTO `draggable_component_report_format` (`id`, `draggable_component_id`, `report_format_id`, `created_at`, `updated_at`) VALUES
(1, 21, 1, '2018-07-05 09:16:37', '2018-07-05 09:16:37'),
(2, 12, 1, '2018-07-05 09:16:37', '2018-07-05 09:16:37'),
(3, 19, 1, '2018-07-05 09:16:37', '2018-07-05 09:16:37'),
(4, 5, 2, '2018-07-05 09:21:59', '2018-07-05 09:21:59'),
(5, 20, 2, '2018-07-05 09:21:59', '2018-07-05 09:21:59'),
(6, 12, 2, '2018-07-05 09:21:59', '2018-07-05 09:21:59'),
(7, 21, 3, '2018-07-05 09:36:19', '2018-07-05 09:36:19'),
(8, 30, 3, '2018-07-05 09:36:19', '2018-07-05 09:36:19'),
(9, 21, 4, '2018-07-05 09:37:39', '2018-07-05 09:37:39'),
(10, 25, 4, '2018-07-05 09:37:39', '2018-07-05 09:37:39'),
(11, 18, 4, '2018-07-05 09:37:39', '2018-07-05 09:37:39'),
(12, 21, 5, '2018-07-05 09:40:59', '2018-07-05 09:40:59'),
(13, 23, 5, '2018-07-05 09:40:59', '2018-07-05 09:40:59'),
(14, 13, 5, '2018-07-05 09:40:59', '2018-07-05 09:40:59'),
(15, 15, 5, '2018-07-05 09:40:59', '2018-07-05 09:40:59');

-- --------------------------------------------------------

--
-- Dumping data for table `report_formats`
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that you are taking dump of one table draggable_components. Instead take dump of whole database librereportgenerator. I think now I'm clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get you!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.
We need only the INSERT sql statements in this file.

--

INSERT INTO `report_formats` (`id`, `user`, `title`, `description`, `system_feature_id`, `created_at`, `updated_at`) VALUES
(1, 'default', 'Patient List', 'List of all patients with basic demographics.', 1, '2018-07-05 09:16:37', '2018-07-05 09:16:37'),
(2, 'default', 'Patients Contacts and Address', 'List of all patient\'s email, phone, street, city and state.', 1, '2018-07-05 09:21:59', '2018-07-05 09:21:59'),
(3, 'default', 'Patient Family Size', 'Information on patient\'s family size', 1, '2018-07-05 09:36:19', '2018-07-05 09:36:19'),
(4, 'default', 'Patient Registration', 'Information on patient\'s registrars, and date.', 1, '2018-07-05 09:37:39', '2018-07-05 09:37:39'),
(5, 'default', 'Patient SS', 'Patients\' SS and postal codes', 1, '2018-07-05 09:40:59', '2018-07-05 09:40:59');

-- --------------------------------------------------------

--
-- Dumping data for table `system_features`
--

INSERT INTO `system_features` (`id`, `name`, `description`, `user`, `created_at`, `updated_at`) VALUES
(1, 'Clients', 'Reports related to clients', 'default', '2018-07-02 04:43:04', '2018-07-02 04:43:04'),
(2, 'Financial', 'Reports related to finance and payments.', 'default', '2018-07-02 08:20:40', '2018-07-02 08:20:40'),
(3, 'Visits', 'Reports concerning patients and other visits.', 'default', '2018-07-04 23:00:00', '2018-07-04 23:00:00'),
(4, 'Procedures', 'Procedure statistics, and other pending orders', 'default', '2018-07-04 23:00:00', '2018-07-04 23:00:00'),
(5, 'Insurance', 'Reports related to patients\' insurance, and other related issues.', 'default', '2018-07-04 23:00:00', '2018-07-04 23:00:00'),
(6, 'Inventory', 'Reports related to inventory at various level in the system.', 'default', '2018-07-04 23:00:00', '2018-07-04 23:00:00');
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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. <[email protected]>
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]>
*/

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. <[email protected]> (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->string('user', 255)->default('default')->comment = "The user who created the feature. This will be 'default' for features that come with the module.";

$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. <[email protected]>
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]>
*/

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. <[email protected]> (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. <[email protected]>
* Copyright 2018 Tigpezeghe Rodrige K. <[email protected]>
*/
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. <[email protected]> (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');
}
}
Loading