2017 © Pedro PelĂĄez
 

library healthmeasures

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

image

towerhouse/healthmeasures

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  • Saturday, February 11, 2017
  • by lube8uy
  • Repository
  • 4 Watchers
  • 3 Stars
  • 5 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Health Measures

towerhousestudio, (*1)

  • This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo.
  • You can configure where to store them and them gather to collect their values by date given a username or other identifier.
  • The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

Tech

Health Measures uses a number of open source projects to work properly:, (*2)

  • [PHP] - <= 5.3
  • [illuminate/config] - 5 . This is the config handler that environments like laravel 4.2 used to have.
  • [amenadiel/jpgraph"] - ^3.6 . This guy ported all the jpgraph library to packagist, thank you.

Installation

  • composer require towerhouse/healthmeasures
  • Include the autoloader.
  • A file on the test's folder test-creation.php will give you a quick review of what the library does.
  • Merge the values from .env.example you want to use in your env or just rename the example to .env.
  • This package should work standalone.

Example of use

Select your storage method on the .env file, (*3)

Enter your measures one by one or using the bulk method, (*4)

//One by one
$mm = new Measure("waist", "cm", "en");
$mm->save();
$mm2 = new Measure("imc", "kg/m2", "es");
$mm2->save();
$mm3 = new Measure("systole", "", "en");
$mm3->save();

//Using the bulk method with a CSV file that has a header
//Don't worry about duplicates

Measure::setDefaultLanguage('es'); //All my csv measures are in spanish
$mm->bulkConstructor(__DIR__ . '/CSV/Measure.csv');

Example of content in Measure.csv, (*5)

name,unit
sistole,    
diastole,
pulso,
peso,kilo
altura,cm
azucar en sangre,mg/dl
SaturaciĂłn de oxĂ­geno en sangre,SaO2
temperatura,ÂșC

Now enter your values, it's the same as measures so, for simplicity we will use the bulk method, (*6)

$v = new Value();
$v->bulkConstructor(__DIR__ . '/CSV/Value.csv');
//Again, don't worry about duplicates

Example of content in Value.csv, (*7)

measure_id,value,owner_id,created_at
2577a46ca60e3ff293ccb0113e6a59c0,97,1,2016-12-29 07:00:00
2577a46ca60e3ff293ccb0113e6a59c0,98,1,2016-12-30 08:00:00
2577a46ca60e3ff293ccb0113e6a59c0,98,1,2016-12-31 06:30:00
2577a46ca60e3ff293ccb0113e6a59c0,98,1,2017-01-01 07:00:00
2577a46ca60e3ff293ccb0113e6a59c0,98,1,2017-01-02 07:00:00
2577a46ca60e3ff293ccb0113e6a59c0,95,1,2017-01-10 11:00:00
2577a46ca60e3ff293ccb0113e6a59c0,95,1,2017-01-15 07:00:00
2577a46ca60e3ff293ccb0113e6a59c0,97,1,2017-01-25 11:00:00

Notice that the owner_id comes from an external system, while measure_id belongs to Healthmeasures. In this case measure_id "2577a46ca60e3ff293ccb0113e6a59c0" it's the id for the measure "waist"., (*8)

Finally we retrieve all the values that the person with identifier 1 had for his waist starting from "2016-01-01" and ending in the most recent date (that would be today, otherwise you specify it on another last parameter), (*9)

$vals = $v->getValuesByDate(1, '2577a46ca60e3ff293ccb0113e6a59c0', "2016-01-01");

Let's create a Stats object and pass the values to generate a linear graph. You can specify a path and the picture will be saved there, otherwise it will be rendered to the client through the browser., (*10)

$stats = new Stats($vals);
$stats->image_path = "linear_sample.jpg";
$stats->generateDateMeasureGraph(Stats::GRAPH_LINEAR);

Finally, you can render a nice and simple html report to your browser with all the details, (*11)

$stats = new Stats($vals);
$stats->image_path = "linear_bar.jpg";
if (!file_exists("linear_bar.jpg")) {
    $stats->generateDateMeasureGraph(Stats::GRAPH_LINEAR);
}
echo $stats->getHtmlReport();

This is a pdf I took from the html page. https://github.com/towerhouse/Healthmeasures/tree/master/test/report.pdf, (*12)

...and this is the image of the graph Alt text, (*13)

Unit testing

There is an article about unit testing I wrote for this library documented here: https://www.linkedin.com/pulse/unit-testing-activity-annoys-programmers-lucia-figueroa-tasca, (*14)

The Versions

11/02 2017

dev-master

9999999-dev

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

11/02 2017

1.3.7

1.3.7.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

08/02 2017

1.3.6

1.3.6.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

06/02 2017

1.3.5

1.3.5.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

06/02 2017

1.3.4

1.3.4.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

06/02 2017

1.3.3

1.3.3.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

05/02 2017

1.3.2

1.3.2.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

02/02 2017

1.3.1

1.3.1.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

02/02 2017

1.3

1.3.0.0

This library gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

01/02 2017

1.2

1.2.0.0

This class gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

29/01 2017

1.1

1.1.0.0

This class gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

by Lucia Figueroa

data health

29/01 2017

1.0

1.0.0.0

This class gives you the ability to generate health measures given a name and a unit, for instance: weight / pound or kilo. You can configure where to store them and them gather to collect their values by date given a username or other token. The library gives you the ability to generate graphs or other stats information. It's totally configurable, methods are well documented and comes with unit testing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lucia Figueroa

data health