Koha/koha-tmpl/intranet-tmpl/prog/en/modules
Jonathan Druart 63a1adff90 Bug 18066: Hea V2
This patch is the Koha part of the Hea v2 project.
You can find the (testing) code for the server at
  hea-ws  - https://github.com/joubu/hea-ws/commits/v2
  hea-app - https://github.com/joubu/hea-app/commits/v2
They contain the different pull requests made over the last 6 months.

More information on Hea at https://wiki.koha-community.org/wiki/KohaUsageStat_RFC
The goal of this commit message is to provide an overview of what could
be a new version of Hea.

Prior to these changes, the Hea database was filled with 1 line per Koha
installation. System preferences were filled by the libraries and a
cronjob (share_usage_with_koha_community.pl) collected these values to send
them to a webservice (hea-ws/upload.pl).

With the need to collect more data we would want to collect data at the library
level (branch) and not at the installation level.
For instance the geolocation, the url or the country can be different from one
library to another, even if managed from the same Koha installation.
The Hea DB has been upgraded to reflect that change (see hea-app/sql/schema.sql).

The hidden goal of this patch is to make Hea sexier and explain
better to libraries how it can be useful to share their information
with the Koha community. I guess the main problem is the lack of
communication and explanations about what we are doing we these data.
To fill this gap I'd like to (TODO)
  1. Communicate on the ML about this new version of Hea (once it got
pushed and backported)
  2. Link the Privacy_Policy.md from the Hea interface
  3. Get help from a native English speaker to add
popup/help/info/whatever on "Home › Administration › Usage statistics",
to clearly explain what happens (and what will not happen!) when an option or
another is set.

You can find screenshot of this whole enhancement on bug 18066, comment 2.

What this patch does:
- Create a new branches.geolocation DB field
- Add 3 new sysprefs:
  * UsageStatsGeolocation
  * UsageStatsLibrariesInfo
  * UsageStatsPublicID
- Integrate the Leaflet JS library to get a fancy map to pick
geolocations

How does it works:
On the new administration page where statistics to share are configured,
there are several new things. It is now possible to share information either
per Koha installation or libraries. If UsageStatsLibrariesInfo is set,
the info at library level (url, name, country, geolocation) will be
sent to the Hea webservice. If it is not set, you can decide to fill
UsageStatsLibraryUrl, UsageStatsLibraryName, UsageStatsCountry,
UsageStatsGeolocation to share these information. Note that even if the
data are retrieved at installation level, it's better to fill the prefs
as well: On the Hea website the different libraries defined for a given
Koha installation could be displayed on the same page.
This page is a public page which will be attributed to every
installation (with the pref UsageStatsPublicID). On this page all the
info available publicly will be displayed.

TODO later:
- Add a button on the administration page to delete the info shared
publicly. It will be easy to show that the info are no longer displayed
on the public page.
- Add an icon per Koha installation to get a better "public page"
- Any suggestions?

Test plan:
We will need to test hea-ws, hea-app and the Koha-side code to test the
whole enhancement.
1/ To start, clone the hea-ws and hea-app project and checkout the
'master' branch (*not* 'v2')
2/ Create the hea database and user
  CREATE DATABASE hea
  CREATE USER 'hea'@'localhost' IDENTIFIED BY 'hea';
  GRANT ALL PRIVILEGES ON hea.* TO 'hea'@'localhost';
  FLUSH PRIVILEGES;
3/ Fill the DB with some data
  mysql hea < hea-app/sql/schema.sql
  mysql hea < hea-app/sql/sql/mock-data.sql
4/ Checkout the 'v2' branch for both hea-ws and hea-app
5/ Execute the upgrade DB script
  % cd hea-app
  % perl -p -i -e 's/REPLACE_ME/hea/' sql/upgrade.pl # Fill the DB info
  % perl sql/upgrade.pl
Now the DB is using the v2 structure. That means we have 1 installation
row per library previously defined. 1 library row has also been created.
5/ Configure hea-ws
% echo '192.168.50.1 hea.koha-community.org' >> /etc/hosts
<VirtualHost *:80>
  DocumentRoot "/path/to/hea-ws"
  ServerName "hea.koha-community.org"
  <Directory "/">
    Options +ExecCGI
    Require all granted
    AddHandler cgi-script .pl
  </Directory>
</VirtualHost>

And enable it with a2ensite, then restart apache.
The copy the database.yml.sample to database.yml and edit it to fill the
DB info.

6/ Launch the hea-app
  % cd hea-app
  % edit README.md # to install the missing modules
  % cp environments/config.yml environments/development.yml
  % edit environments/development.yml # to fill the DB info
  % perl bin/app.pl
Then hit localhost:3000
You should see a local version of Hea with sample data

7/ Back to Koha side
A. We will test that the webservice still works with previous version of Koha (without v2)
a. Do not configure Hea
  % perl misc/cronjobs/share_usage_with_koha_community.pl -f -v
Then hit localhost:3000
=> Nothing added
b. Configure Hea on admin/usage_statistics.pl
perl misc/cronjobs/share_usage_with_koha_community.pl -f -v
=> New library added
c. Modify the Hea configuration
perl misc/cronjobs/share_usage_with_koha_community.pl -f -v
=> Info are modified

B. Not we will test that it works with the new version (much more fun ;))
% git checkout hea-v2 # koha
a. Configure Hea using /admin/usage_statistics.pl
perl misc/cronjobs/share_usage_with_koha_community.pl -f -v
=> Check the result on localhost:3000
b. Share libraries's info
perl misc/cronjobs/share_usage_with_koha_community.pl -f -v
c. Continue to play a bit and share the info.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2017-03-23 00:10:46 +00:00
..
acqui Bug 10978: Redirect to basket list of a supplier after deleting a basket 2017-03-03 18:26:46 +00:00
admin Bug 18066: Hea V2 2017-03-23 00:10:46 +00:00
authorities Bug 17780: Add a comment to explain the line 2017-02-15 11:13:00 +00:00
basket Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
batch
catalogue Bug 18047 - JavaScript error on item search form unless LOC defined 2017-02-14 14:11:38 +00:00
cataloguing Bug 17487: Styling moved from style attribute into staff-global.css 2017-01-20 14:11:55 +00:00
circ Bug 16530: Add a new method to the Branches TT Plugin to avoid c/p 2017-03-03 18:34:36 +00:00
common Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
course_reserves Bug 18264 - (QA Followup) Remove use of GetBiblioFromItemNumber Replace <blank> with (blank) 2017-03-22 19:04:43 +00:00
errors
help Bug 18122 - Audio alerts: Add hint on where to enable sounds 2017-03-03 18:15:53 +00:00
installer Bug 14608: Add a reference to Hea at the end of the installer process 2017-03-22 23:51:29 +00:00
labels Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
members Bug 17334: Format the date according to the system preference 2017-03-03 17:51:21 +00:00
offline_circ
patron_lists Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
patroncards Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
plugins Bug 17793: Follow up for identified missing changes 2017-02-17 15:34:11 +00:00
reports Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
reserve Bug 18076: Replace holds_to_place_count with an input type=text 2017-02-14 13:51:21 +00:00
reviews Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
rotating_collections Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
serials Bug 15030 - continue. The enumchron value was overwritten by 'header' even when value supplied 2017-02-07 17:43:48 +00:00
services
sms
suggestion Bug 17977: Add acquisitions sidebar menu to suggestions 2017-02-17 12:12:56 +00:00
tags Bug 16239: Update templates 2017-01-13 14:41:22 +00:00
test
tools Bug 18135: Show alert if no authorities selected in batch record deletion 2017-03-03 18:37:37 +00:00
virtualshelves Bug 7663 - batch add barcodes to a list 2017-03-03 18:18:13 +00:00
about.tt Bug 18066: Hea V2 2017-03-23 00:10:46 +00:00
auth.tt Bug 9569: Update warning message 2017-01-30 11:25:06 +00:00
intranet-main.tt Bug 17960: Replace missing occurrences 2017-02-06 17:42:14 +00:00