diff --git a/.gitignore b/.gitignore index f8b7c8fff694053401fdc44ac33cda425cd5e353..c824089091f1d7bd36b8d5b13b9975928b5afb1b 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,12 @@ smash/htmlcov/ run-coverage.sh media + +#debian package tmp files +smasch_*.debian.tar.xz +smasch_*.dsc +smasch_*.orig.tar.xz +smasch_*_all.deb +smasch_*_amd64.build +smasch_*_amd64.changes +debian/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3bb6195f8b389f7df76e62c4e86d852561246c7..a493401d98bdea0e629d01ad25965392607ba302 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,12 +6,16 @@ variables: POSTGRES_USER: runner POSTGRES_PASSWORD: password -before_script: - - apt-get update && apt-get install -y --allow-unauthenticated libsasl2-dev libssl-dev locales locales-all - - pip install -r requirements.txt --default-timeout=180 -i https://pypi.lcsb.uni.lu/simple/ - - pip install -r requirements-dev.txt --default-timeout=180 -i https://pypi.lcsb.uni.lu/simple/ + +.test_template: &test_definition + stage: test + before_script: + - apt-get update && apt-get install -y --allow-unauthenticated libsasl2-dev libssl-dev locales locales-all + - pip install -r requirements.txt --default-timeout=180 -i https://pypi.lcsb.uni.lu/simple/ + - pip install -r requirements-dev.txt --default-timeout=180 -i https://pypi.lcsb.uni.lu/simple/ test_postgres: + <<: *test_definition services: - postgres:latest script: @@ -22,9 +26,151 @@ test_postgres: - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" test_sqlite: + <<: *test_definition + script: + - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py" + - cd smash + - python manage.py makemigrations web && python manage.py migrate + - coverage run --source web manage.py test -v3 + - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" + +test_python_3.7: + <<: *test_definition + image: python:3.7 + script: + - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py" + - cd smash + - python manage.py makemigrations web && python manage.py migrate + - coverage run --source web manage.py test -v3 + - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" + +test_python_3.8: + <<: *test_definition + image: python:3.8 + script: + - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py" + - cd smash + - python manage.py makemigrations web && python manage.py migrate + - coverage run --source web manage.py test -v3 + - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" + +test_python_latest: + <<: *test_definition + image: python:latest script: - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py" - cd smash - python manage.py makemigrations web && python manage.py migrate - coverage run --source web manage.py test -v3 - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" + +build_debian: + image: debian + stage: build + only: + - tags + artifacts: +# you cannot enforce never here yet + expire_in: 1000 yrs + paths: + - "*.deb" + script: + - apt-get update + - DEBIAN_FRONTEND=noninteractive apt-get install -y dh-make build-essential lintian devscripts xsltproc fakeroot xsltproc docbook-xsl + - export DEBFULLNAME="Piotr Gawron" + - export DEBEMAIL="piotr.gawron@uni.lu" + - chmod 0755 build_deb.sh + - ./build_deb.sh + +test_install_debian_package_ubuntu_18: + image: ubuntu:18.04 + stage: test + only: + - tags + services: + - name: piotrgawron/debian-repo + alias: debian-repo + dependencies: + - build_debian + script: + - apt-get update + - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl + - debian_file=$(ls *.deb) + - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo + - ssh root@debian-repo /usr/local/sbin/reprepro-import + - apt-add-repository "deb http://debian-repo/ unstable main" -n + - apt-get update --allow-insecure-repositories + - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated smasch +#systemd is not available on docker so we need to start manually gunicorn (gunicorn.service is not tested) + - cd /usr/lib/smasch/ + - /usr/lib/smasch/env/bin/gunicorn -b 127.0.0.1:8888 --pid /run/gunicorn/pid smash.wsgi --error-logfile /var/log/smasch/gunicorn.log --log-level DEBUG --capture-output --limit-request-line 8192 & +#we need to wait a bit for gunicorn start + - sleep 15 + - wget http://localhost:8888/account/login/?next=/ +#test if we can login and list projects + - test 302 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/) + - test 200 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/account/login/?next=/) + +test_install_debian_package_ubuntu_20: + image: ubuntu:20.04 + stage: test + only: + - tags + services: + - name: piotrgawron/debian-repo + alias: debian-repo + dependencies: + - build_debian + script: + - apt-get update + - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl + - debian_file=$(ls *.deb) + - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo + - ssh root@debian-repo /usr/local/sbin/reprepro-import + - apt-add-repository "deb http://debian-repo/ unstable main" -n + - apt-get update --allow-insecure-repositories + - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated smasch +#systemd is not available on docker so we need to start manually gunicorn (gunicorn.service is not tested) + - cd /usr/lib/smasch/ + - /usr/lib/smasch/env/bin/gunicorn -b 127.0.0.1:8888 --pid /run/gunicorn/pid smash.wsgi --error-logfile /var/log/smasch/gunicorn.log --log-level DEBUG --capture-output --limit-request-line 8192 & +#we need to wait a bit for gunicorn start + - sleep 15 + - wget http://localhost:8888/account/login/?next=/ +#test if we can login and list projects + - test 302 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/) + - test 200 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/account/login/?next=/) + +test_install_debian_package_debian_buster: + image: debian:buster + stage: test + only: + - tags + services: + - name: piotrgawron/debian-repo + alias: debian-repo + dependencies: + - build_debian + script: + - apt-get update + - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl + - debian_file=$(ls *.deb) + - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo + - ssh root@debian-repo /usr/local/sbin/reprepro-import + - apt-add-repository "deb http://debian-repo/ unstable main" + - apt-get update --allow-insecure-repositories + - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated smasch +#systemd is not available on docker so we need to start manually gunicorn (gunicorn.service is not tested) + - cd /usr/lib/smasch/ + - /usr/lib/smasch/env/bin/gunicorn -b 127.0.0.1:8888 --pid /run/gunicorn/pid smash.wsgi --error-logfile /var/log/smasch/gunicorn.log --log-level DEBUG --capture-output --limit-request-line 8192 & +#we need to wait a bit for gunicorn start + - sleep 15 + - wget http://localhost:8888/account/login/?next=/ +#test if we can login and list projects + - test 302 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/) + - test 200 = $(curl -X GET --write-out %{http_code} --silent --output /dev/null http://localhost:8888/account/login/?next=/) + +test_version_in_base_html: + script: + - CURRENT_VERSION=`cat CHANGELOG |grep smasch |head -1 | cut -f2 -d'(' | cut -f1 -d')' | cut -f1 -d'-' ` + - test 1 = $(cat smash/web/templates/_base.html |grep "<strong>$CURRENT_VERSION</strong>" |wc -l) + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000000000000000000000000000000000000..dbe23372c4f65f254a3bf043cb4e1328d2818257 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,451 @@ +smasch (1.0.0~alpha.1-0) unstable; urgency=low + + * small improvement: django command for creating admin in application (#347) + * small improvement: django admin panel contains usable data tables (#346) + * small improvement: possibility to unfinish visit (#351) + * small improvement: all requests to export data to csv/xls are tracked + (#285) + + -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 10 Nov 2020 14:00:00 +0200 + +smasch (1.0.0~alpha.0-0) unstable; urgency=low + + * backward incompatible: smasch is using python3 (#337) + * improvement: docker script is available (#338) + * improvement: sqlite3 database is supported (#344) + * improvement: deb package that can be installed on ubuntu/debian machines + (#342) + * small improvement: login background is configurable (#327) + + -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 27 Oct 2020 14:00:00 +0200 + +smasch (0.15.0) stable; urgency=low + + * small improvement: new permission: add_subject (#324) + * small improvement: automatic daily import from tns (#323) + * small improvement: show data provenance in subject edit form (#326) + + -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 07 Apr 2020 13:38:08 +0200 + +smasch (0.14.0) stable; urgency=low + + * small improvement: address is available in list of subject columns (#310) + * small improvement: no new appointments can be scheduled when subject is + marked as excluded, resigned, deceased or endpoint reached (#309) + * small improvement: issue date can be entered manually on voucher creation + (#312) + * small improvement: there is possibility to select RedCap checks (#300) + * small improvement: permissions list extended. New permissions: view daily + planning; modify sample kits (equipement items); modify flying teams; + modify rooms; view kit requests; view statistics; modify mail templates; + can export (#322) + * small improvement: next of keen data added to subject (#318) + * small improvement: simple data provenance- we track changes about: + appointments, who and when marked subjects as deceased, resigned, who + finished visit (#317) + * bug fix: label for font color fixed (#320) + * bug fix: exception should handled properly when there is a problem with + uploading mail templates (#321) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 05 Apr 2020 09:33:54 +0200 + +smasch (0.13.1) stable; urgency=low + + * bug fix: Allow cancelled events to be dragged out of the daily planning + (#305) + * bug fix: Disable Visit button after visit is submitted (#306) + * bug fix: Add format to disabled workers (#307) + * bug fix: Edit visit page doesn't allow to change worker (#308) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 10 Apr 2019 10:27:21 +0200 + +smasch (0.13.0) stable; urgency=low + + * small improvement: Enpoint reached column added + * small improvement: Option "removed" to vouchers + * small improvement: Option to show all voucher types when issuing a voucher + to a subject + * small improvement: Possibility to remove appointment + * small improvement: Automatically add extra-availability if a worker is + assigned an appointment + * small improvement: Faster way to edit a subject visit and/or to add + appointments to current visit + * small improvement: pages are restricted to roles + * small improvement: Show more information about cancelled and finished + appointments in daily planning + * small improvement: Show workers in daily planning by availability + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 29 Mar 2019 16:15:35 +0100 + +smasch (0.12.2) stable; urgency=low + + * bug fix: save of the study is not rejected when there are empty nd numbers + * bug fix: clear button in daily planning is working properly again + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 22 Nov 2018 11:22:09 +0100 + +smasch (0.12.1) stable; urgency=low + + * bug fix: Sorting screening number column could fail (#271) + * bug fix: Voucher functionality problems (partner not showing up in table, + or number, or template) (#267) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Nov 2018 09:18:23 +0100 + +smasch (0.12.0) stable; urgency=low + + * small improvement: every voucher have a number of hours to be used attached + to it. (#211) + * small improvement: every voucher should be valid for 90 days only (#212) + * small improvement: project manager role added (#233) + * small improvement: document generation for vouchers (#196) + * small improvement: nd_number regex check is a configuration option (#257) + * small improvement: Add excluded boolean field and exclude reason string + field to StudySubject Model (#254) + * small improvement: Flags in daily planning: subjects and workers have flags + assigned to them (#260) + * small improvement: Possibility to remove some roles from Daily Planning + (#250) + * small improvement: Horizontal scroll in subject list added (#240) + * small improvement: exceeded visit status is not applicable for visits that + have unfinished appointments (#219) + * small improvement: Configuration page for a study (#215) + * small improvement: sort by screening_number (#207) + * small improvement: add possibility to have daily availability for short + period of time (#204) + * small improvement: User management page (#127) + * small improvement: export custom set of columns (#161) + * bug fix: Fix overflow of daily planning board and add some links (#252) + * bug fix: sending weekly email could crash (#259) + * bug fix: Duplicates in exceeded visit time removed (#249) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 06 Nov 2018 11:06:11 +0100 + +smasch (0.11.3) stable; urgency=low + + * bug fix: template generated for appointment with flying team name in + unicode returned 500 + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 03 Sep 2018 15:13:00 +0200 + +smasch (0.11.2) stable; urgency=low + + * bug fix: daily scheduling bug which didn't allow to show daily scheduling + when appointment had time length = 0 (#209) + * bug fix: email with kit request contain double entries for patients with + two appointment_types that should be included in it (#210) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 04 May 2018 16:02:07 +0200 + +smasch (0.11.1) stable; urgency=low + + * bug fix: cron jobs were improperly defined and all cron jobs were not fired + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 19 Feb 2018 10:35:43 +0100 + +smasch (0.11.0) stable; urgency=low + + * improvement: vouchers implemented (#182) + * improvement: auto expire of vouchers (#197) + * improvement: voucher expiry notification (#190) + * improvement: voucher types (#187) + * improvement: voucher partners (#127) + * improvement: health partners (#127) + * small improvement: when first appointment in first visit is finished adjust + visit dates (#180) + * small improvement: exceed visit list doesn't include first visit (#179) + * small improvement: subject required contact list contains more column by + default (#177) + * small improvement: default columns visible in subjects without visit list + modified (#176) + * small improvement: default columns visible in Unfinished appointments list + modified (#174) + * small improvement: default columns visible in approaching visits list + modified (#173) + * small improvement: default columns visible in exceeded visits list modified + (#146) + * small improvement: default columns visible in unfinished visits list (#146) + * small improvement: additional column in kit request email (#206) + * small improvement: list of visits/subjects/appointments have short + description of what this list is about (#201) + * small improvement: separation of study data and demographics (#181) + * small improvement: flying team management (#178) + * small improvement: pdp related study fields (#186) + * small improvement: follow up visit creation is configurable (#192) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 14 Feb 2018 16:12:34 +0100 + +smasch (0.10.2) stable; urgency=low + + * bug fix: security issue (#199) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 Jan 2018 10:17:45 +0100 + +smasch (0.10.1) stable; urgency=low + + * bug fix: generating from mail templates could throw an error (#165) + * bug fix: when appointment date changes then information about daily + planning for this appointment is removed (so the time constraints are not + violated) (#172) + * bug fix: empty workers (without credentials) were created with every email + (#171) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Nov 2017 15:07:54 +0100 + +smasch (0.10.0) stable; urgency=low + + * improvement: subject list contain info about visits with filter possibility + (#140) + * improvement: there is possibility to remove scheduled appointment that is + not attached to subject visit (#150) + * improvement: there is possibility to disable user account - it's not + visible in daily planning, and user cannot login anymore (#151) + * improvement: In daily planning there is possibility to schedule general + appointments (that are not assigned to any patient visit) (#160) + * small improvement: Calendar view with appointments contain initials of + people (doctors, nurses, ...) who are available that day (#143) + * small improvement: Validation added for entered nd numbers (it must match + NDxxxx) (#148) + * small improvement: Subject contains field for information about reason of + resignation from the study (#155) + * small improvement: Start date of the follow up visit is based on the date + of the first visit (not on the date of the last visit) (#169) + * small improvement: Subject country is a list not a free text (#170) + * bug fix: When exporting subject list to excel there is additional + (artificial) column with information if patient dropped out (it's marked + true when patient had at least one finished appointment and resigned) + (#156) + * bug fix: Opening of the new tab by clicking on "Edit" button in subject + list fixed #149 + * bug fix: Resolution of export to pdf improved (#168) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 06 Nov 2017 11:14:27 +0100 + +smasch (0.9.1) stable; urgency=low + + * small improvement: daily planning uses abbreviation in the title of the + appointment type in calendar view + * small improvement: log info about sending sms added + * bug fix: update of an appointment cleared data from daily planning + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Oct 2017 12:44:04 +0200 + +smasch (0.9.0) stable; urgency=low + + * improvement: export of daily planning to pdf (#153) + * small improvement: in daily planning user appointments show the location + (#154) + * small improvement: when saving finished appointment there is check on + subject nd number (#158) + * small improvement: daily planning uses fixed colors (instead of random + values) to avoid possibility of having too similar colors (#163) + * bug fix: exception could occur when updating appointment (#162) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 13 Oct 2017 12:59:39 +0200 + +smasch (0.8.1) stable; urgency=low + + * small improvement: subject "contact on" field renamed (#147) + * small improvement: in appointment calendar view on hover shows appointment + location (#141) + * small improvement: daily planning has info about time start (#142) + * bug fix: cannot open visit for subject that has not finished visit (#144) + * bug fix: problem with availabilities (#152) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 29 Sep 2017 11:31:03 +0200 + +smasch (0.8.0) stable; urgency=low + + * improvement: Two factor authentication (#80) + * improvement: Export to excel (#131) + * improvement: Worker availability and holidays (#17) + * improvement: Simple connection to RED Cap. Comparison of differences + between data from redcap and scheduling system using following fields + (#124): nd number (existence of the subject with given id), date of birth, + gender, death, spoken languages, mpower ID + * improvement: system logs (#130) + * small improvement: Possibility to modify contact attempts (#132) + * small improvement: Possibility to add/edit contact attempts from an + appointment view (#134) + * small improvement: Subjects with flying team location should have default + flying team location defined (#139) + * small improvement: Possibility to add appointment from visit list for the + unfinished visit (#133) + * small improvement: Show completed appointment types on visit page (#115) + * small improvement: Exiting edit page without saving will trigger confirm + button (#136) + * small improvement: Worker list is in alphabetical order (#135) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Sep 2017 10:23:13 +0200 + +smasch (0.7.0) stable; urgency=low + + * improvement: automatic email system about samples to technician (#81) + * small improvement: check for duplicates when adding new subject (#122) + * small improvement: uniqueness check of mpower id (#125) + * small improvement: new calendar view of appointments (#112) + * small improvement: new filter list for subjects (#117) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 21 Jun 2017 16:06:23 +0200 + + +smasch (0.6.0) stable; urgency=low + + * improvement: daily planning (#101) + * improvement: add command to import public holidays (#100) + * small improvement: field "pd in family" has now three states ("unknown", + "false" or "true"). All entries which has this value set to "false" are now + set to "unknown". An import from excel should in the futur fix this to + restore the real "false" values (#107) + * small improvement: a link to navigate to the corresponding visit from an + appointment has been added (#111) + * small improvement: after editing an appointment from a visit, return to the + visit (#116) + * small improvement: remove "Visits" section from the menu (#108) + * small improvement: upgrade django version to 1.10.7 (#109) + * small improvement: subjects list is now, by default, filtered based on the + user location and ordered by ND number (#104) + * small improvement: screening number will be generated if left empty (based + on location first and subject type if location is FT) (#96) + * small improvement: change some appointment types descriptions (#98) + * small improvement: change label for field "contact on†on contact attempt + page (#95) + * small improvement: change default number of subjects displayed to 25 on + subjects list (#103) + * small improvement: subject model: default value for year of diagnosis + should be null not 0 (#106) + * bug fix: improve compatibility with lower resolutions (#102) + * bug fix: datatables search should be case insensitive (#105) + * bug fix: fix issue with appointment list pagination (#120) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 19 May 2017 10:27:45 +0200 + +smasch (0.5.1) stable; urgency=low + + * bug fix: statistics view: patient/control filter is not taken into account + when visit is set (#97) + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 21 Apr 2017 10:24:11 +0200 + +smasch (0.5.0) stable; urgency=low + + * improvement: contact attempts + * improvement: automatic post mail creation + * improvement: configuration panel for system configuration options (like + colors, mail adresses, etc) + * small improvement: after subject is added system stays on the edit subject + page + * small improvement: cancelled appointments are 'GREY' in callendar view + * small improvement: no show appointments are "RED' in callendar view + * small improvement: kit requests (equipment&rooms->kit request) contain + information about location and person who is responsible for the + appointment + * small improvement: subject contain two additional boolean fields: PD in + family, information sent. Infomration sent is also visible in subject list + webpage + * small improvement: appointment contains additional boolean field: post mail + sent + * small improvement: performance of subject list page is improved + * small improvement: performance of appointment list page is improved + * small improvement: performance of calendar view is improved (calendar data + is no longer limited, so you can take a look at all appointments, + previously you couldn't see appointments before 1 month ago) + * small improvement: whenever selecting flying team place (like chem, + clervox, etc). Flying team location is set automatically + * small improvement: subject contact on field contains hour + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 12 Apr 2017 10:53:15 +0200 + +smasch (0.4.1) stable; urgency=low + + * bug fix: issue with computation of appointments duration + * bug fix: version static files to force browsers to download new versions of + files + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 03 Apr 2017 14:04:48 +0200 + +smasch (0.4.0) stable; urgency=low + + * improvement: screening number is generated automatically for users with + defined screening number prefix + * improvement: screening number can be changed + * improvement: there is possibility to add appointments without subject + * improvement: appointment type list in visit is editable as list of + checkboxes + * improvement: when editing appointment there is possibility to edit subject + on the same page + * improvement: when adding new visit the end date is computed automatically + (+3 months) + * improvement: monthly statistics + * bug fix: when marking subject as deceased/resigned information was not + saved properly + * bug fix: when marking visit as finished information was not saved properly + * bug fix: list of visits/appoitntments from reminder is sorted by date + * bug fix: visit id field removed from editing appointment + * bug fix: visit list doesn't allow to change properties of the visit + * bug fix: login problem for users with non ascii characters in their names + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 29 Mar 2017 11:48:10 +0200 + +smasch (0.3.1) stable; urgency=low + + * bug fix: location column could contain invalid value + * bug fix: user could create appointment for location to which he was not + assigned + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Mar 2017 17:34:35 +0100 + +smasch (0.3.0) stable; urgency=low + + * improvement: there is view for upcoming examinations requiring kits + (disponsible items) + * improvement: notification with remonder to send post email for upcoming + visit (3-6 months before visit) + * improvement: selecting appointment type in appointment view automatically + recalculate time required for appointment + * improvement: each subjest has optional field with requested contact date, + this date is used to create a notification about contact request + * improvement: subject has possibility to be 'postponed' - this will exclude + subject from list of subjects without visit + * bug fix: refirection after login fixed + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 17 Mar 2017 08:43:10 +0100 + +smasch (0.2.1) stable; urgency=low + + * improvement: unfinished visit notification is split into two: visits that + are unfinished; visits that have some unscheduled appointments available + * improvement: every visit has optional list of examinations agreed by the + subject + * improvement: edit an appointment has link to edit subject when applicable + * improvement: there is no extra view subject data view + * improvement: screening number is not generated automatically + * improvement: there is default subject communication language added + * improvement: click oin calendar redirects to edit appointment view + * improvement: after new visit is added there is button to add new + appointment + * bug fix: export to csv was broken when new line appeard in comment + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 09 Mar 2017 18:40:22 +0100 + +smasch (0.2.0) stable; urgency=low + + * improvement: export of subjects and appointments to csv added + * improvement: notifications added (exceeded visit time, subject without + visit, unfinished visits, approching visits, unfinished appointments) + * improvement: calendar is separated between locations + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 07 Mar 2017 18:10:42 +0100 + +smasch (0.1.2) stable; urgency=low + + * bug fix: appointments are working + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 02 Mar 2017 10:26:38 +0100 + +smasch (0.1.1) stable; urgency=low + + * Initial release + + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 20 Feb 2017 15:27:14 +0100 + diff --git a/build_deb.sh b/build_deb.sh new file mode 100644 index 0000000000000000000000000000000000000000..d79a514ef9b1b8b25e8829bdda86ca5e19a683c0 --- /dev/null +++ b/build_deb.sh @@ -0,0 +1,26 @@ +#!/bin/bash +ROOT=`pwd` +rm -rf debian +rm smasch_*.debian.tar.xz smasch_*.dsc smasch_*.orig.tar.xz smasch_*_all.deb smasch_*_amd64.build smasch_*_amd64.changes + +find . -name "*.py[co]" -exec rm -f {} \; +find . -name "__pycache__" -exec rm -rf {} \; + +mkdir debian +mkdir debian/smash +cp -r smash/web debian/smash/web +cp -r smash/smash debian/smash/smash +cp -r smash/db_scripts debian/smash/db_scripts +cp smash/manage.py debian/smash/manage.py +cp -r debian-template debian/debian-template +cp CHANGELOG debian/debian-template/changelog +rm debian/smash/smash/local_settings.py +cp -r debian-files debian/debian-files + +CURRENT_VERSION=`cat CHANGELOG |grep smasch |head -1 | cut -f2 -d'(' | cut -f1 -d')' | cut -f1 -d'-' ` + +cd debian +dh_make -p smasch_$CURRENT_VERSION -s --createorig -e piotr.gawron@uni.lu -y -t $ROOT/debian/debian-template +rm debian/*.ex +rm debian/*.EX +debuild -us -uc diff --git a/debian-files/logrotate/smasch b/debian-files/logrotate/smasch new file mode 100644 index 0000000000000000000000000000000000000000..628c7e294c01aaa97a8166fc187ca8a333d9d8b2 --- /dev/null +++ b/debian-files/logrotate/smasch @@ -0,0 +1,22 @@ +/var/log/smasch/gunicorn.log { + copytruncate + size 32k + weekly + dateext + rotate 52 + compress + missingok + create 600 smasch smasch +} +/var/log/smasch/smasch.log { + copytruncate + size 32k + weekly + dateext + rotate 52 + compress + missingok + create 600 smasch smasch +} + + diff --git a/debian-files/smasch.py b/debian-files/smasch.py new file mode 100644 index 0000000000000000000000000000000000000000..5a860c1a694174471b8516fc7b2177c903ade16b --- /dev/null +++ b/debian-files/smasch.py @@ -0,0 +1,66 @@ +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'Paste long random string here' # Insert long random string + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = False + +# Should the static/media files be served by Django +SERVE_STATIC = True + +WSGI_APPLICATION = 'smash.wsgi.application' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '/usr/lib/smasch/db.sqlite3', + } +} + +STATIC_ROOT = '/usr/lib/smasch/data/static' +MEDIA_ROOT = '/usr/lib/smasch/data/media' + +LOGIN_PAGE_BACKGROUND_IMAGE = 'background.jpg' # Path to a static file containing background image, used in login.html + +ALLOWED_HOSTS = ["127.0.0.1", "localhost"] + +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' +NEXMO_API_KEY = 'API_KEY' +NEXMO_API_SECRET = 'API_SECRET' +NEXMO_DEFAULT_FROM = 'Scheduling' # the sender of the message (phone number or text) + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'file': { + 'level': 'INFO', + 'class': 'logging.FileHandler', + 'filename': '/var/log/smasch/smasch.log', + 'formatter': 'verbose' + }, + 'console': { + 'class': 'logging.StreamHandler', + 'level': 'DEBUG', + 'formatter': 'simple' + }, + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + }, + 'simple': { + 'format': '%(levelname)s %(message)s' + }, + }, + 'loggers': { + 'django': { + 'handlers': ['file'], + 'level': 'INFO', + }, + 'web': { + 'handlers': ['file'], + 'level': 'DEBUG', + }, + }, +} + diff --git a/debian-files/smasch.service b/debian-files/smasch.service new file mode 100644 index 0000000000000000000000000000000000000000..e272f3bcc9c96423e120eca5d30f70f57af3d419 --- /dev/null +++ b/debian-files/smasch.service @@ -0,0 +1,19 @@ +[Unit] +Description=gunicorn daemon for smasch +Requires=smasch.socket +After=network.target + +[Service] +PIDFile=/run/smasch/pid +User=smasch +Group=smasch +WorkingDirectory=/usr/lib/smasch + +ExecStart=/usr/lib/smasch/env/bin/gunicorn --pid /run/smasch/pid smash.wsgi --error-logfile /var/log/smasch/gunicorn.log --log-level DEBUG --capture-output --limit-request-line 8192 +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s TERM $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target + diff --git a/debian-files/smasch.socket b/debian-files/smasch.socket new file mode 100644 index 0000000000000000000000000000000000000000..9995a7df43979979612ffdec6db3df472763f402 --- /dev/null +++ b/debian-files/smasch.socket @@ -0,0 +1,11 @@ +[Unit] +Description=gunicorn socket for smasch + +[Socket] +ListenStream=/run/smasch/socket +ListenStream=0.0.0.0:8888 +ListenStream=[::]:9999 + +[Install] +WantedBy=sockets.target + diff --git a/debian-template/README.Debian b/debian-template/README.Debian new file mode 100644 index 0000000000000000000000000000000000000000..62db161eaeb804b2083963cf6783024787b8a2aa --- /dev/null +++ b/debian-template/README.Debian @@ -0,0 +1,10 @@ +smasch for Debian +---------------- + + SMart SCHeduling - research study scheduling program + The program controls and simplifies the scheduling, and is able to manage a + big data base of patients. Smasch is also used to organize the daily + planning’s (delegation of tasks) for the different medical professionals + such as doctors, nurses and neuropsychologists. + + -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 27 Oct 2020 13:19:16 +0100 diff --git a/debian-template/compat b/debian-template/compat new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/debian-template/compat @@ -0,0 +1 @@ +9 diff --git a/debian-template/conffiles b/debian-template/conffiles new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/debian-template/control b/debian-template/control new file mode 100644 index 0000000000000000000000000000000000000000..e484e4cee2bb1ab321281d038d6ba1270d3c1b8e --- /dev/null +++ b/debian-template/control @@ -0,0 +1,19 @@ +Source: smasch +Section: science +Priority: optional +Maintainer: Piotr Gawron <piotr.gawron@uni.lu> +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.7 +Homepage: https://git-r3lab.uni.lu/NCER-PD/scheduling-system/ +#Vcs-Git: git://anonscm.debian.org/collab-maint/smasch.git +Vcs-Browser: https://git-r3lab.uni.lu/NCER-PD/scheduling-system.git + +Package: smasch +Architecture: all +Section: science +Depends: ${misc:Depends}, python3(>=3.6), virtualenv, libcurl4-gnutls-dev, libpng-dev, libfreetype6-dev, libpq-dev, gcc, g++, python3-dev, libgnutls28-dev, libjpeg-dev, libfreetype6-dev, pkg-config, cron +Description: SMart SCHeduling - research study scheduling program + The program controls and simplifies the scheduling, and is able to manage a + big data base of patients. Smasch is also used to organize the daily + planning’s (delegation of tasks) for the different medical professionals + such as doctors, nurses and neuropsychologists. diff --git a/debian-template/copyright b/debian-template/copyright new file mode 100644 index 0000000000000000000000000000000000000000..f6a4a29e5bb4360bdc794b0c9cb7532558efd234 --- /dev/null +++ b/debian-template/copyright @@ -0,0 +1,24 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: smasch +Source: https://git-r3lab.uni.lu/NCER-PD/scheduling-system/ + +Files: * +Copyright: 2020 Piotr Gawron piotr.gawron@uni.lu + 2020 Carlos Vega carlos.vega@uni.lu +License: GPL-2+ + This package 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; either version 2 of the License, or + (at your option) any later version. + . + This package 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 <https://www.gnu.org/licenses/> + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + diff --git a/debian-template/files b/debian-template/files new file mode 100644 index 0000000000000000000000000000000000000000..d8c007dc98fce66614b9beff4a58ee41d7e853c8 --- /dev/null +++ b/debian-template/files @@ -0,0 +1 @@ +smasch_0.15.0_all.deb science optional diff --git a/debian-template/install b/debian-template/install new file mode 100644 index 0000000000000000000000000000000000000000..b122a4d00f031b2026c6611458070d589c63ee0f --- /dev/null +++ b/debian-template/install @@ -0,0 +1,9 @@ +smash/manage.py /usr/lib/smasch +smash/web /usr/lib/smasch +smash/smash /usr/lib/smasch +../requirements.txt /usr/lib/smasch +../requirements-dev.txt /usr/lib/smasch +debian-files/smasch.py /etc/smasch/ +debian-files/smasch.service /lib/systemd/system/ +debian-files/smasch.socket /lib/systemd/system/ +debian-files/logrotate/smasch /etc/logrotate.d diff --git a/debian-template/postinst b/debian-template/postinst new file mode 100644 index 0000000000000000000000000000000000000000..c6f237ddcdbee5217f65bbb0896239ba1ae2bcfe --- /dev/null +++ b/debian-template/postinst @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e + +LOG_FILE=/var/log/smasch/install.log + +if [ "$1" = "configure" ] && [ -z "$2" ]; then + id -u smasch &>/dev/null || useradd smasch + if ! getent group smasch >/dev/null; then + addgroup --quiet --system smasch + fi + + ln -sf /etc/smasch/smasch.py /usr/lib/smasch/smash/local_settings.py + + virtualenv --python=python3 /usr/lib/smasch/env + + chown smasch:smasch /etc/smasch/smasch.py + chmod 0600 /etc/smasch/smasch.py + + mkdir -p /run/smasch/ + chown -R smasch:smasch /run/smasch/ + + mkdir -p /var/log/smasch + +fi + +echo "Installing python dependencies" +{ + source /usr/lib/smasch/env/bin/activate && pip install -r /usr/lib/smasch/requirements.txt --log $LOG_FILE + source /usr/lib/smasch/env/bin/activate && pip install -r /usr/lib/smasch/requirements-dev.txt --log $LOG_FILE +} || { + echo "There was an issue when installing python dependencies." >> $LOG_FILE + echo "There was an issue when installing python dependencies. Reinstall of smasch could help (in case you are upgrading smasch the data should not be lost in the process): " + echo "apt-get remove smasch" + echo "apt-get install smasch" + exit 1 +} + +echo "Collecting static files" +source /usr/lib/smasch/env/bin/activate && /usr/lib/smasch/manage.py collectstatic --no-input >> $LOG_FILE 2>&1 + +echo "Applying database changes" +source /usr/lib/smasch/env/bin/activate && /usr/lib/smasch/manage.py migrate --no-input >> $LOG_FILE 2>&1 + +chown -R smasch:smasch /usr/lib/smasch + +chown -R smasch:smasch /var/log/smasch + +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true +fi + +if [ "$1" = "configure" ] && [ -z "$2" ]; then + crontab -u smasch -l 2>/dev/null | grep -v "runcrons" | { cat; echo "*/5 * * * * . /usr/lib/smasch/env/bin/activate && python /usr/lib/smasch/manage.py runcrons >> /var/log/smasch/cronjob.log 2>&1"; } | crontab -u smasch - +fi + +#DEBHELPER# + diff --git a/debian-template/postrm b/debian-template/postrm new file mode 100644 index 0000000000000000000000000000000000000000..5e89cb293527b4affbe06c2bfae5ea7d77f33d2b --- /dev/null +++ b/debian-template/postrm @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e + +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true +fi + +case "$1" in + purge) + rm -rf /usr/lib/smasch + if getent passwd smasch >/dev/null; then + userdel smasch + fi + if getent group smasch >/dev/null; then + groupdel smasch + fi + rm -rf /run/smasch/ + +;; + remove) + rm -rf /usr/lib/smasch/env/ + rm -rf /usr/lib/smasch/web/ +;; + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) +;; + +*) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 +;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian-template/prerm b/debian-template/prerm new file mode 100644 index 0000000000000000000000000000000000000000..15f6cbb055c8e1bc75d523b3721a6d59d61a8803 --- /dev/null +++ b/debian-template/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +invoke-rc.d smasch stop + +crontab -u smasch -l 2>/dev/null | grep -v "runcrons" | crontab -u smasch - + + +#DEBHELPER# + diff --git a/debian-template/rules b/debian-template/rules new file mode 100644 index 0000000000000000000000000000000000000000..fac20c955eaf53d908dddaed06bcc2c7a6db265a --- /dev/null +++ b/debian-template/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/requirements.txt b/requirements.txt index 36a5df540c22919d24dc0c04b89a5cb034697a4f..49a543a076f30f5d39b61889939d1ecfedebdedc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,7 @@ lxml==4.5.2 matplotlib==2.2.3 mockito==1.2.2 nexmo==2.3.0 -numpy==1.16.1 +numpy==1.19.2 pandas==1.1.3 django-datatables-view==1.19.1 phonenumberslite==8.9.14 @@ -57,5 +57,6 @@ texttable==1.4.0 timeout-decorator==0.4.0 Unidecode==1.0.22 urllib3==1.23 +whitenoise==5.2.0 xlrd==1.1.0 xlwt==1.3.0 diff --git a/smash/smash/settings.py b/smash/smash/settings.py index e09b05f045bacae4e9e3667e8f55f52623dc0f0c..edaaa38ada3e74eb94a52f64e755b527497e5f30 100644 --- a/smash/smash/settings.py +++ b/smash/smash/settings.py @@ -20,6 +20,8 @@ PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) DEBUG = True +SERVE_STATIC = False + # Application definition INSTALLED_APPS = [ @@ -44,6 +46,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -136,3 +139,7 @@ LOGOUT_REDIRECT_URL = 'web.views.appointments' STRONGHOLD_PUBLIC_NAMED_URLS = (LOGIN_URL,) from .local_settings import * + +if not SERVE_STATIC: + MIDDLEWARE.remove('whitenoise.middleware.WhiteNoiseMiddleware') + diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html index 015a026b1caf69c931fd05f65a2f51565e189320..cc0899bf0ca63cc53ee7811bf525959e36d96ba2 100644 --- a/smash/web/templates/_base.html +++ b/smash/web/templates/_base.html @@ -260,7 +260,7 @@ desired effect {% block footer %} <!-- To the right --> <div class="pull-right hidden-xs"> - Version: <strong>0.15.0</strong> (7 Apr 2020) + Version: <strong>1.0.0~alpha.1</strong> </div> <!-- Default to the left -->