Project: Improvement of the setup for LibreHealth EHR


(Michael Downey) #4

+1 to not using Google Docs.

@mua_rachmann if you want, you can make the top post in this topic a “wiki” post" (use the post options menu) so you can add all of your content from the google doc here.

(mua laurent) #5

@teryhill , @tony , @pri2si17, @aethelwulffe Here is the rundown of my project and the major points my project will address

In summary this is all about improving the setup for LibreHealth. This procedure will entail

  1. Creating and Designing a new UI for the setup procedure

  2. Offer a two way flow of the setup (using next and previous buttons).

  3. Correct versioning of the system until the extension for php 7.1 is totally merged (which is avoided for now) but i see this could be included.

  4. Upgrade server system’s dependencies if not optimal for the LibreHealth EHR environment.

  5. Initialization of important parameters such as email , clinic name , default theme , etc upon a successful install.

  6. A rapid walkdown tutorial on basic things the software does (in the form of images/sliders) of course there will be a skip button if the user wants to ignore this

This project is primarily aimed not only at producing an eye catching setup but at producing a setup environment that is optimal for LibreHealth EHR.

(Priyanshu Sinha) #6

@mua_rachmann I like the breakdown, but I would suggest one thing to you. IMO, you should first focus on functionality, regardless of UI (an okay UI will work in initial stages). Once you have rigorously tested your functionality, then work on UI. I think if we have a fully functional code, that can be adapted to UI later on.

Also I would like if you develop this as a standalone module. Opinion of @teryhill @aethelwulffe and @tony are much appreciated. :slight_smile:

(mua laurent) #7

Yeah! @pri2si17, the implementation will be done as a separate module found in the modules/setup dir as suggested by @aethelwulffe earlier.

(Tony McCormick) #8

@mua_rachmann - looks good to me. The core functions of the setup should have the ability to be run from an command line script. Then add UI. The current core is the Installer.class.php

There is an example in OpenEMR that might be useful to look at (not use, just get an idea or two)

(mua laurent) #9

@pri2si17, @tony, @teryhill the coding phase has begun and here is what i have started and plan to do.

  • Created a modules/setup directory (still doubting if i should put the installer class i am about to write here or leave it in the library folders)

  • I plan on creating a wizard class that will take care of the pages for the setup flow

  • Plan on using composer for dependency management.

Let me know your thoughts please

(Priyanshu Sinha) #10

@mua_rachmann some comments :

  1. Is your installer class is completely independent of rest of the code base? If yes, then move it from library directory, or else keep it there.

  2. I think composer is good to use for dependency management. I am in favor of using it. Let @tony @teryhill have their thoughts.

(mua laurent) #11

Yeah that’s the case it will be completely independent.

(Tony McCormick) #12

Composer is good with me, we need to make sure that how it’s used is well documented. We use it a lot (in my company) for customized versions of the EHR, where the “base” release is a dependency of the custom repo… etc.

(mua laurent) #13

Here is the link to my blog.You can read about my journey into gsoc2018 also

(mua laurent) #14

Implementation of my project proposal is ongoing and can be found here.

All ideas are welcomed. Lets make this a success :grinning:

(mua laurent) #15

Ajax call for datbase creation in LibreHealth setup


// show loader


     // variables to hold all form parameters such as login name, password , iuname etc
    var localhost = $("#server").val();                var port = $("#port").val();
    var dbname = $("#dbname").val();                var pass = $("#pass").val();
    var rootpass = $("#rootpass").val();               var loginhost = $("#loginhost").val();
    var login = $("#login").val();                     var root = $("#root").val();
    var collate = $("#collate").val();                  var iuser = $("#iuser").val();
    var iuserpass = $("#iuserpass").val();              var iufname = $("#iufname").val();
    var iuname = $("#iuname").val();                  var igroup = $("#igroup").val();

    var data = {
        localhost : localhost,
        dbname : dbname,
        rootpass : rootpass,
        login : login,
        collate : collate,
        iuserpass : iuserpass,
        iuname : iuname,
        port : port,
        pass : pass,
        loginhost : loginhost,
        root : root,
        iuser : iuser,
        iufname : iufname,
        igroup : igroup

       url : "database.php",
       data: data,
       success : function (response) {
       error: function (error) {

(mua laurent) #16

This can be found in the LIbreEHR/modules/setup/libs/js/setup.js file

(mua laurent) #17

Bash Scripting also possible in LibreHealth EHR

On my journey in implementing my GSoC project i am faced with a situation to install dependencies the setup module will be requiring in order for it to run smoothly.

A shell script is optimal for this.

First we should know what is a "Shell". It is nothing but an interface between the user and the services of an operating systems such as UNIX, LINUX, Mac or WINDOWS (to some extent).

The interface can be through command line (CLI) or in a graphical manner (GUI). There are several shells such as sh (Bourne Shell) ksh (Korn Shell), csh (‘C’ Shell) etc. A script written in such an environment is called a “Shell Script”.

Generally scripts can be used to achieve several tasks. Listed only a few:

  1. Create your own command/tool
  2. Monitor several tasks like disk usage, etc
  3. Taking data backups and snapshots
  4. Any user needing to automate the process of setting up and running applications, or their own code.

There are so many reasons we want to have our own shell scripts written. For our purpose , we write a script that will automate the process of manually downloading the dependencies necessary for libreEHR. this script has as primary function to get all dependencies necessary for the effective and efficient running of LibreEHR. While it focuses mostly on the LINUX/UNIX and MACOS platforms this script must be ran as a privilege user no other than the root cause no one will want to allow installation from a third party software is some level of permission access is not granted :slight_smile: The few lines of code put up is what i have done so for now concentrates on the debian distro more to come folks :wink:

(mua laurent) #18
#! /bin/bash

if [[ "$EUID" = 0 ]]; then

echo "(1) already root"

zenity --question --width=350 --height=100 --text="Do you want to install this package?" --title="LibrehealthEHR Upgrade" 2> /dev/null

   echo $test

ans=$(zenity --title="LibrehealthEHR Upgrade" --list --width=600 --height=300  --text "The following packages will be installed (you can decide to uncheck ones already installed.)" --checklist  --column "Pick" --column "options" TRUE "php7.0-curl" TRUE "php7.0-xml" FALSE "php7.0-soap" FALSE "php7.0-mbstring" --separator=":" 2> /dev/null);'

    echo $ans
    sudo -k # make sure to ask for password on next sudo
if sudo true; then
    echo "(2) correct password"
    sudo apt-get install php7.0-curl;
    sudo apt-get install php7.0-xml;
    sudo apt-get install php7.0-mbstring;
    echo " wrong password more than (3) attempts"

exit 1 fi fi

(Priyanshu Sinha) #19

Hi @mua_rachmann

I think this is good, that you execute script in background, but do have some option for windows as they don’t execute bash :wink:

(mua laurent) #20

Yes have a walk down tuto thats the best i can do except you have some ideas. Plan on some carousel for wampp/xampp download and how to configure their php i think a 1-5 slide show will do or some clean descriptive video/gif but i go for the carousel with clean images. Probably @apooravc will help here since he’s on windows just to give us his experience

(mua laurent) #21

Bash Scripting continues(version 2)

Scripting has never been cool as i have made a version 2 of my shell script. This can be found here

(mua laurent) #22

(mua laurent) #23