Niccolo': a chemicals inventory

cage 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
data d64b1b7199 - fixed points of h phrases in risk calculation. 1 month ago
federated-query 9bce576fd7 - updated licence. 1 month ago
lib 9bce576fd7 - updated licence. 1 month ago
locale d99e26d540 - updated italian translation; 2 days ago
script 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
sensors 9bce576fd7 - updated licence. 1 month ago
templates 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
www 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
.gitattributes dd650064a3 - added .gitattributes to help linguist. 1 year ago
.gitignore 08970eb434 Initial commit 2 years ago
COPYING 08970eb434 Initial commit 2 years ago
LICENSES.org 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
Makefile.am af513f70ba - Added graph generation from sensor's data; 1 year ago
README.org b490fe42d8 - updated email. 11 hours ago
address.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
adr-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
assoc-chem-haz-prec-federated-query.lisp 1bfd5596ba - improved samples; 1 week ago
assoc-chem-haz.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
assoc-chem-prec.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
assoc-user-lab.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
authentication.lisp 79c214f592 - added functionality to udate an user's profile; 1 week ago
building.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
cer-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
chemical-compound.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
chemical-product.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
conditions.lisp 0b413077e7 - removed tabs. 1 month ago
config.lisp.in f7dfa76c05 - added complete/long name for laboratory; 2 weeks ago
configuration-utils.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
configure.ac 9bce576fd7 - updated licence. 1 month ago
constants.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
db-config.lisp 9bce576fd7 - updated licence. 1 month ago
db-utils.lisp 9bce576fd7 - updated licence. 1 month ago
db.lisp 1bfd5596ba - improved samples; 1 week ago
general-routes.lisp 9bce576fd7 - updated licence. 1 month ago
ghs-haz.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
ghs-precautionary.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
hp-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
i18n.lisp 9bce576fd7 - updated licence. 1 month ago
images-utils.lisp 9bce576fd7 - updated licence. 1 month ago
l-factor-snpa.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
l-factor.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
lab.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
laboratory.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
map.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
math-utils.lisp 9bce576fd7 - updated licence. 1 month ago
messages.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
molecule.lisp 9bce576fd7 - updated licence. 1 month ago
molfile.lisp f15c536029 - added confirmation warning for some operations; 2 weeks ago
niccolo.asd cd815aacef - updated asdf. 11 hours ago
package.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
person.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
ps-utils.lisp 9bce576fd7 - updated licence. 1 month ago
quick_quicklisp.sh.in 40efeed222 - added a basic import procedure. 1 year ago
risk-calculator-const.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
risk-calculator-snpa.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
risk-calculator.lisp 8359eb5b4a - fixed xml template for configuration files macro; 1 month ago
risk-phrases.lisp 9bce576fd7 - updated licence. 1 month ago
sample.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
sensors.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
services.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
session-user.lisp 79c214f592 - added functionality to udate an user's profile; 1 week ago
start_server-cas.sh.in a62fa54943 - fixed package in starting script. 1 year ago
start_server.sh.in a62fa54943 - fixed package in starting script. 1 year ago
storage.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
string-utils.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-address.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-building.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-chemical-compound.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-chemical-product.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-ghs-hazard.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-ghs-precautionary.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-hp-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-laboratory.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-map.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-person.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-sample.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-storage.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-user.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
update-waste-physical-state.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
user.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
utils.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
validation.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
views.lisp 9bce576fd7 - updated licence. 1 month ago
waste-letter.lisp 8dc4c109f9 - allow minimal HTML on some kind of messages. 10 hours ago
waste-physical-state.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 6 days ago
waste-stats.lisp 79c214f592 - added functionality to udate an user's profile; 1 week ago
xml-utils.lisp 9bce576fd7 - updated licence. 1 month ago

README.org

Introduction

Niccolo' is a web based software aimed at safe chemicals storage, using and disposing.

Building

Niccolo' is written in Common Lisp, except for a few of libraries (written in C) it depends on.

Dependency

Library

Niccolo' depends on the following common lisp libraries:

  • alexandria;
  • cl-ppcre-unicode;
  • trivial-timeout;
  • bordeaux-threads;
  • dbi;
  • cl-smtp;
  • cl-sanitize;
  • envy;
  • parse-number;
  • xmls;
  • html-template;
  • cl-base64;
  • osicat;
  • log4cl;
  • ironclad;
  • cl-who;
  • cl-json;
  • flexi-streams;
  • cl-gd;
  • hunchentoot;
  • drakma;
  • restas;
  • restas-directory-publisher;
  • cl-pslib;
  • cl-pslib-barcode;
  • cl-i18n;
  • crane.

Except for crane (see below) all of them are available from quicklisp.

For crane a patched version (available here), is needed.

Also be sure to install the following C libraries:

  • libxml2 (needed for cl-sanitize)
  • libgd;
  • libsqlite3;
  • pslib.

External programs

  • sbcl;
  • wget;
  • sqlite3;
  • screen;
  • gcc;
  • bash;
  • autotools build system (i.e. autoconf, automake etc).

Installation

Note: Assuming directory ~/lisp exists and is writable.

Also basic ASDF knowledge is mandatory.

Moreover steps 2-5 and 10-11 may be skipped if you have quicklisp already installed and ASDF configured (but you should install all the Dependency anyway, via quicklisp).

  1. cd ~/lisp/
  2. wget https://beta.quicklisp.org/quicklisp.lisp
  3. wget https://beta.quicklisp.org/quicklisp.lisp.asc
  4. wget https://beta.quicklisp.org/release-key.txt
  5. check quicklisp gpg key
  6. clone niccolo repository
  7. cd niccolo
  8. autoreconf -fiv
  9. ./configure
  10. cd ~/lisp && bash niccolo/quick_quicklisp.sh (the script will download and install most of the libraries, also will help you to configure ASDF);
  11. clone this version of crane in ~/quicklisp/local-projects;
  12. checkout branch sqlite for crane
  13. cd ~/quicklisp/dists/quicklisp/software/cl-gd-0.6.1
  14. make
  15. cd ~/lisp/niccolo/
  16. make
  17. put your ssl certificate in ssl/
  18. edit config.lisp

#+BEGIN_SRC lisp

(define-constant path-prefix "/niccolo" :test #'string=)

;; ssl

(define-constant hostname "xxxxxxxxx" :test #'string=)

(defparameter ssl-certfile (asdf:system-relative-pathname :lab #p"ssl/xxx.pem"))

(defparameter ssl-key (asdf:system-relative-pathname :lab #p"ssl/xxxx.pem"))

(define-constant ssl-pass "xxxxxx" :test #'string=)

#+END_SRC

  1. Optional, configure this section for email notifications.

#+BEGIN_SRC lisp ;; smtp config

;; you want actually to use mail notification? Set this value to a ;; non nil value ('t' for example). (define-constant use-smtp nil :test #'eq)

(define-constant smtp-host "localhost" :test #'string=)

(define-constant smtp-from-address "noreply@localhost" :test #'string=)

(define-constant smtp-port-address 465 :test #'=)

;; '() for no authentication (define-constant smtp-autentication '("username" "password") :test #'equalp)

;; use nil for no ssl (define-constant smtp-ssl t :test #'string=)

(define-constant smtp-subject-mail-prefix "[niccolo] " :test #'string=)

#+END_SRC

  1. Optional (but strongly not recommended), use federated-query

A niccolo server can federate with other software's instances (i.e. other servers running the same software) to share parts of their database on the net.

Hopefully there will be some documentation some day in the future, in the meanwhile the only documentation are the sources. :(

It is not recommended to enable federated query except for study or testing purposes

#+BEGIN_SRC lisp

(define-constant federated-query-enabled nil :test #'string=)

;; key for federated query, change it!

(define-constant federated-query-key "/yGHgfè%a6s!" :test #'string=)

#+END_SRC

furthermore you need to specify a nodes file named 'nodes-list.expr'

#+BEGIN_SRC lisp

(in-package :federated-query)

(define-nodes-list (define-node "nome of the federated host" 8443))

#+END_SRC

  1. Optional (but strongly recommended), use CAS autentication

#+BEGIN_SRC lisp ;; cas config

(define-constant cas-server-host-name "" :test #'string=)

(define-constant cas-server-path-prefix "" :test #'string=) #+END_SRC

you need to compile mini-cas library to use this feature see: CAS authentication below.

  1. Optional (but strongly recommended)
  2. If you plan to put niccolo behind a reverse proxy (and we recommend to do so) also set:

#+BEGIN_SRC lisp (define-constant https-proxy-port -1 :test #'=) #+END_SRC

to the actual port (usually 443) where your http server is listening on the internet/intranet.

  1. Sensors and data logger

The directory sensors/temp and sensors/gas contains two loggers for arduino compatible with the protocol implemented for this software (essentially http with MAC authentication).

    To build the software you will need:
  • For temperature monitoring
  • Hardware
  • an arduino with a ethernet shield;
  • DS18B20 temperature sensor.
  • Software
  • the arduino IDE and these libraries not bundled with the IDE
  • https://github.com/PaulStoffregen/OneWire
  • https://github.com/milesburton/Arduino-Temperature-Control-Library
  • For gas monitoring
  • Hardware
  • an arduino with a ethernet shield;
  • MQ135 gas sensor.
  • Software
  • the arduino IDE
  1. sh 'start_server.sh' (or sh 'start_server-cas.sh'
  2. if you are using [[CAS authentication][the CAS authentication protocol]])
  1. point your browser to
  2. =https://+hostname+:(+https-poxy-port+|+https-port+)/+path-prefix+/add-admin/= where =+hostname+= and =+path-prefix+= are the values of the variables setted in point 19, also specify the actual port your server is listening on the internet (=+https-poxy-port+= or =+https-port+=) to generate the administrator account.

Authentication

Niccolo comes with two kinds of autenthication mechanisms.

Internal database of users

The first is based on an table in its own database which stores username/password.

We does not recommend using this kind of authentication as it was developed just for testing purposes.

CAS authentication

Niccolo includes a CAS client library (in .../lib/ directory) for authentication, this is what we use in our production environment.

To enable CAS authentication just put the mini-cas directory in a place where ASDF is going to be able to find (load, actually) it, niccolo will use CAS automatically. Then edit config.lisp in the CAS section.

If mini-cas is not loaded with ASDF niccolo' will use internal authentication instead.

Please note that, depending of the content of your source-registry.conf file (expecially if you use the :tree options), .../lib/mini-cas/ will be reached by ASDF.

Start server

BUGS

Use the 'start_server.sh' or 'start_server-cas.sh' scripts to start the server without or with CAS authentication respectively.

Please send bug report to cage-dev at twistfold dot it

Known bugs

  • federated query works only in sbcl.
  • not strictly a bug maybe, but mq135 is very sensible to humidity and temperature variation.

License

This program is Copyright (C) 2016 Universita' degli Studi di Palermo and released under GNU General Public license version 3 (see COPYING file).

The program use data and code from other sources, please see LICENSE.org.

Although any efforts has been put to make the list of credits exaustive, errors are always possible. Please send correction to cage-dev at twistfold dot it.

Contributing

Any help is appreciated. Please send a message to cage-dev at twistfold dot it.

NO WARRANTY

niccolo': a chemicals inventory Copyright (C) 2016 Universita' degli Studi di Palermo

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see .