medal-hub
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
medal-hub [2021/12/14 17:00] – arnaud_poletto | medal-hub [2022/01/14 16:27] (current) – Alan Vonlanthen | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== medAL-hub Documentation ====== | ====== medAL-hub Documentation ====== | ||
- | ==== About medAL-hub | + | The purpose of medAL-//hub// is 3-fold: |
+ | - Relay between the tablets, thus allowing to start a consultation on a tablet and finish it on another one (client-server). | ||
+ | - Local database for the clinical data. | ||
+ | - Hub for the data synchronisation with the National server (medAL-// | ||
- | The purpose of medAL-hub is 3-fold: | ||
- | - Relay between the tablets, thus allowing to start a consultation on a tablet and finish it on another one (Client server) | ||
- | - Local database for the clinical data | ||
- | - Hub for the data synchronisation with the National server (medAL-data) | ||
+ | ===== medAL-hub Setup and Management ===== | ||
- | ==== medAL-hub | + | * [[medal-hub: |
+ | * [[medal-hub: | ||
- | === Prerequisite === | ||
- | Follow the procedure given in [[IT-physical-deployment|Health Facility IT Physical deployment]]. \\ | ||
- | At this point, you should be able to connect to the following wifi networks: \\ | ||
- | // | ||
- | // | ||
+ | ===== medAL-hub User Guide and Troubleshooting ===== | ||
+ | * [[medal-hub: | ||
+ | * [[medal-hub: | ||
- | === Material Needed === | ||
- | You will need the following material: | + | ===== medAL-hub Data Sync Schedule ===== |
- | | + | There are 2 scripts on the hub for syncing: |
- | | + | |
- | * An SD card reader | + | |
- | * An HDMI to micro-HDMI cable (NOT mini) [[https:// | + | * huge caveat |
- | * A PowerBank (5Vx3A (15W) output) [[https:// | + | |
- | * A Power Adapter (USB + Power) [[https://www.amazon.com/ | + | |
- | * An internet | + | |
- | * A PC connected to internet, with admin rights | + | |
- | * A screen with HDMI connection | + | |
- | * A USB keyboard | + | |
- | === SD Card Setup === | ||
- | - Download and open BalenaEtcher from: https:// | ||
- | - Download the HypriotOS image: https:// | ||
- | - Plug in your SD card inside the SD card reader. | ||
- | - In BalenaEtcher, | ||
- | - Click on //Select target// and select your SD card. | ||
- | - Click on //Flash!//, and wait until the flash is complete. | ||
- | |||
- | |||
- | |||
- | === RasPI Setup === | ||
- | |||
- | - Put the SD card back in the RasPI. | ||
- | - Connect the RasPI to the following: | ||
- | * HDMI (0) \\ {{:: | ||
- | * Ethernet (if present) | ||
- | * A Keyboard | ||
- | * A Screen | ||
- | * The PowerBank | ||
- | - Wait until you see “login” and a blinking underscore (after about 4 minutes). That means you are ready to start. If no login then repeat steps above. | ||
- | |||
- | == WiFi Setup == | ||
- | |||
- | Enter the credentials (press //Enter// between each and be careful: **the keyboard is UK by default**): \\ | ||
- | Username: //pirate// \\ | ||
- | Password: //hypriot// | ||
- | |||
- | The next step is to create the '' | ||
- | |||
- | < | ||
- | |||
- | If you are configuring the hub for an offline facility, also add the following line: | ||
- | < | ||
- | |||
- | After that, we have to give a name to each of the network configurations. In order to do that, open ''/ | ||
- | < | ||
- | |||
- | And add the two '' | ||
- | < | ||
- | ssid=”health_facility_dynamic” | ||
- | # | ||
- | psk=… | ||
- | id_str=”hf” | ||
- | } | ||
- | network={ | ||
- | ssid=”mobile_dynamic” | ||
- | # | ||
- | psk=… | ||
- | id_str=”mobile” | ||
- | } | ||
- | </ | ||
- | |||
- | Save file using 1. //Ctrl-X// 2. Confirm //Y// 3. Press //Enter// | ||
- | After that, we have to link the '' | ||
- | < | ||
- | |||
- | And edit the file to make it exactly as below: | ||
- | < | ||
- | #source / | ||
- | |||
- | allow-hotplug wlan0 | ||
- | iface wlan0 inet manual | ||
- | wpa-roam / | ||
- | |||
- | iface hf inet dhcp | ||
- | iface mobile inet dhcp | ||
- | </ | ||
- | |||
- | Save file using 1. //Ctrl-X// 2. Confirm //Y// 3. Press //Enter// | ||
- | |||
- | After that, we can activate the wlan0 interface: | ||
- | < | ||
- | |||
- | Make sure to save the changes and reboot: | ||
- | < | ||
- | |||
- | The device should now be connected to the internet. | ||
- | < | ||
- | |||
- | in order to verify this. (//Ctrl-C// to exit '' | ||
- | Now that the connection is established, | ||
- | < | ||
- | |||
- | and take note of the following values (under wlan0 interface) | ||
- | * inet | ||
- | * netmask | ||
- | * broadcast | ||
- | These values will be useful later. Run: | ||
- | < | ||
- | |||
- | And take note of the nameserver address (the first address that appears). | ||
- | Run: | ||
- | < | ||
- | |||
- | Make the necessary changes (under hf interface): | ||
- | < | ||
- | |||
- | allow-hotplug wlan0 | ||
- | iface wlan0 inet manual | ||
- | wpa-roam / | ||
- | |||
- | iface hf inet static | ||
- | address 178.17.54.136 | ||
- | netmask 255.255.255.0 | ||
- | network 178.17.54.0 | ||
- | broadcast 178.17.54.255 | ||
- | gateway 178.17.54.1 | ||
- | dns-nameservers 178.17.54.1 | ||
- | iface mobile inet dhcp | ||
- | </ | ||
- | |||
- | Replace the relevant values with the ones from the previous step. The '' | ||
- | |||
- | Make sure to save the changes and reboot: | ||
- | < | ||
- | |||
- | The connection should now be established (again). | ||
- | |||
- | |||
- | |||
- | |||
- | == Application Setup == | ||
- | |||
- | Clone the repository and checkout the '' | ||
- | < | ||
- | cd liwi-local-data | ||
- | git checkout master | ||
- | </ | ||
- | |||
- | Create the environment file: | ||
- | < | ||
- | nano .env | ||
- | </ | ||
- | |||
- | And set the health facility ID to the desired value by updating the '' | ||
- | < | ||
- | sudo nano .env | ||
- | </ | ||
- | Save file using 1. //Ctrl-X// 2. Confirm //Y// 3. Press //Enter// | ||
- | |||
- | Install //nginx//, //php// and other requirements: | ||
- | < | ||
- | sudo apt update | ||
- | sudo apt upgrade | ||
- | sudo apt install nginx php composer php-zip php-xml php-fpm php-pgsql | ||
- | </ | ||
- | |||
- | Restart: | ||
- | < | ||
- | |||
- | Start the docker container, install pendencies and prepare the database: | ||
- | < | ||
- | composer install | ||
- | php artisan key: | ||
- | php artisan migrate | ||
- | </ | ||
- | |||
- | Open the nginx configuration file: | ||
- | < | ||
- | |||
- | And insert the following server block (right after the //# Virtual Host Configs//): \\ | ||
- | The two ''# | ||
- | < | ||
- | #include / | ||
- | #include / | ||
- | server { | ||
- | listen 80; | ||
- | listen 443 ssl; | ||
- | ssl_certificate / | ||
- | ssl_certificate_key / | ||
- | # | ||
- | root / | ||
- | add_header X-Frame-Options " | ||
- | add_header X-Content-Type-Options " | ||
- | index index.php; | ||
- | charset utf-8; | ||
- | location / { | ||
- | try_files $uri $uri/ / | ||
- | } | ||
- | location = / | ||
- | location = / | ||
- | error_page 404 /index.php; | ||
- | client_max_body_size 0; | ||
- | location ~ \.php$ { | ||
- | fastcgi_pass unix:/ | ||
- | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
- | include fastcgi_params; | ||
- | } | ||
- | location ~ / | ||
- | deny all; | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | We can verify that the nginx configuration is valid using the following command: | ||
- | < | ||
- | |||
- | After that, we have to change the permissions of the project folder so that each component of the application (the web server and the database) can access the required files: | ||
- | < | ||
- | sudo chown -R root:root / | ||
- | sudo usermod -a -G www-data pirate | ||
- | </ | ||
- | |||
- | Restart the docker container: | ||
- | < | ||
- | docker-compose up -d | ||
- | </ | ||
- | |||
- | Restart nginx: | ||
- | < | ||
- | |||
- | Go to [[http://< | ||
- | |||
- | |||
- | |||
- | |||
- | ==== medAL-hub Maintenance Setup ==== | ||
- | |||
- | == Update script == | ||
- | |||
- | We are now going to create a script to update the application from the git repository: | ||
- | < | ||
- | touch ~/update.sh | ||
- | chmod +x ~/update.sh | ||
- | nano ~/update.sh | ||
- | </ | ||
- | |||
- | The content of the script should look like this: | ||
- | < | ||
- | #!/bin/sh | ||
- | cd / | ||
- | docker-compose down | ||
- | git pull | ||
- | docker-compose up -d | ||
- | composer install | ||
- | php artisan key: | ||
- | php artisan migrate | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | == Crontab Setup == | ||
- | |||
- | We need to configure cron jobs so that Laravel can run synchronization jobs and that the update script gets executed everyday. | ||
- | Open crontab: | ||
- | < | ||
- | |||
- | And add the following jobs: | ||
- | < | ||
- | * * * * * php / | ||
- | 30 16 * * * / | ||
- | </ | ||
- | |||
- | The exact time of the update can be adjusted based on the health facility requirements (in this example it is set to update at 16:30 everyday). | ||
- | |||
- | |||
- | |||
- | |||
- | == Sync configuration == | ||
- | |||
- | Open the configuration file for synchronization: | ||
- | < | ||
- | |||
- | And choose the appropriate configuration options. | ||
- | |||
- | * '' | ||
- | * Choose '' | ||
- | * Choose true if a reliable connection is only available from time to time, e.g. during a few minutes each day. In that case, the hub will attempt to push the cases as soon as a connection can be established with the main data server. | ||
- | * '' | ||
- | * These values are used to reach the main data server. | ||
- | * '' | ||
- | * This value is the number of hours after which the cases are considered out-of-sync (starting from creation time). Synchronization will be triggered as soon as any closed case is out-of-sync and connection is available. The value for online mode should to be much higher than the one for offline mode because a reliable connection is expected to be available in online mode. For this reason, cases in online mode only become out-of-sync when the daily scheduled synchronization cannot take place for some reason. | ||
- | |||
- | |||
- | |||
- | |||
- | == Synchronization Using a Mobile Hotspot (Offline facilities) == | ||
- | In the case where no connection is available at the health facility, it is possible to perform a synchronization with the help of a mobile phone with a mobile internet connection that can act as a hotspot. The procedure is the following: | ||
- | * Unordered List ItemThe hotspot should be configured with the ssid and the password specified in '' | ||
- | * As soon as the connection is established, | ||
- | * In order to make sure that the transaction completed successfully, | ||
medal-hub.1639497607.txt.gz · Last modified: 2021/12/14 17:00 by arnaud_poletto