Niccolo': a chemicals inventory

cage ac12c57a96 - reverted missing menu's entries; 2 weeks ago
data ecd53d4f42 - added usage tracking of chemicals; 1 month ago
federated-query 9bce576fd7 - updated licence. 3 months ago
lib 9bce576fd7 - updated licence. 3 months ago
locale 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
script 8dc4c109f9 - allow minimal HTML on some kind of messages. 2 months ago
sensors 9bce576fd7 - updated licence. 3 months ago
templates ac12c57a96 - reverted missing menu's entries; 2 weeks ago
www 1a2daf0d7d - added a new messages notification mechanism; 2 weeks 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 999609196c - decode html entities in some autocomplete iput form; 1 month ago
Makefile.am af513f70ba - Added graph generation from sensor's data; 2 years ago
README.org 6d21c86386 - added a readme in plain text format. 1 month ago
address.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
adr-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
assoc-chem-haz-prec-federated-query.lisp 1bfd5596ba - improved samples; 2 months ago
assoc-chem-haz.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
assoc-chem-prec.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
assoc-user-lab.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
authentication.lisp ac12c57a96 - reverted missing menu's entries; 2 weeks ago
building.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
carcinogenic-logbook.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
cer-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
chemical-compound.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
chemical-product-tracking.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
chemical-product.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
conditions.lisp 0b413077e7 - removed tabs. 3 months ago
config.lisp.in f7dfa76c05 - added complete/long name for laboratory; 2 months ago
configuration-utils.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
configure.ac 9bce576fd7 - updated licence. 3 months ago
constants.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
db-config.lisp 9bce576fd7 - updated licence. 3 months ago
db-utils.lisp 9bce576fd7 - updated licence. 3 months ago
db.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
general-routes.lisp 9bce576fd7 - updated licence. 3 months ago
ghs-haz.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
ghs-precautionary.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
hp-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
i18n.lisp 9bce576fd7 - updated licence. 3 months ago
images-utils.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
l-factor-snpa.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
l-factor.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
lab.lisp ac12c57a96 - reverted missing menu's entries; 2 weeks ago
laboratory.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
map.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
math-utils.lisp ecd53d4f42 - added usage tracking of chemicals; 1 month ago
messages.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
molecule.lisp 9bce576fd7 - updated licence. 3 months ago
molfile.lisp f15c536029 - added confirmation warning for some operations; 2 months ago
niccolo.asd 4ac4552a65 - added carcinogenic logbook; 1 month ago
package.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
person.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
ps-utils.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
quick_quicklisp.sh.in 40efeed222 - added a basic import procedure. 1 year ago
readme.txt 6d21c86386 - added a readme in plain text format. 1 month ago
risk-calculator-const.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
risk-calculator-snpa.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
risk-calculator.lisp 8359eb5b4a - fixed xml template for configuration files macro; 3 months ago
risk-phrases.lisp 9bce576fd7 - updated licence. 3 months ago
sample.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
sensors.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
services.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
session-user.lisp ac12c57a96 - reverted missing menu's entries; 2 weeks 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 999609196c - decode html entities in some autocomplete iput form; 1 month ago
string-utils.lisp 999609196c - decode html entities in some autocomplete iput form; 1 month ago
update-address.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-building.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-chemical-compound.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-chemical-product.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
update-ghs-hazard.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-ghs-precautionary.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-hp-codes.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-laboratory.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-map.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-person.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
update-sample.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-storage.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-user.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
update-waste-physical-state.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
user.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
utils.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
validation.lisp 1a2daf0d7d - added a new messages notification mechanism; 2 weeks ago
views.lisp 9bce576fd7 - updated licence. 3 months ago
waste-letter.lisp 4ac4552a65 - added carcinogenic logbook; 1 month ago
waste-physical-state.lisp 08ec0ce4f5 - trying to clean all parameters from the clients; 2 months ago
waste-stats.lisp 79c214f592 - added functionality to udate an user's profile; 2 months ago
xml-utils.lisp 9bce576fd7 - updated licence. 3 months 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 .