{"id":21252227,"url":"https://github.com/wattrex/battery-experiments-manager","last_synced_at":"2026-03-16T18:02:27.398Z","repository":{"id":191639506,"uuid":"682072772","full_name":"WattRex/Battery-Experiments-Manager","owner":"WattRex","description":"A web service and a database to review and manage battery experiments","archived":false,"fork":false,"pushed_at":"2024-02-14T07:46:46.000Z","size":1763,"stargazers_count":4,"open_issues_count":13,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-23T13:46:14.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WattRex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-23T11:31:48.000Z","updated_at":"2024-01-28T15:16:20.000Z","dependencies_parsed_at":"2023-08-30T22:39:07.040Z","dependency_job_id":"e9f379b8-911f-4152-8a16-4e5565ec6421","html_url":"https://github.com/WattRex/Battery-Experiments-Manager","commit_stats":null,"previous_names":["wattrex/battery-experiments-manager"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WattRex%2FBattery-Experiments-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WattRex%2FBattery-Experiments-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WattRex%2FBattery-Experiments-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WattRex%2FBattery-Experiments-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WattRex","download_url":"https://codeload.github.com/WattRex/Battery-Experiments-Manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690115,"owners_count":20331725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T03:46:40.291Z","updated_at":"2025-10-24T02:53:55.233Z","avatar_url":"https://github.com/WattRex.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battery Experiments Manager\n\n## Description\nThis repository contains the code of the Battery Experiments Manager, a web application that allows to manage the experiments of any battery cycling laboratory. It is developed in Python, using the Django framework, and it is based on the MVC architecture. It is also used a MySQL database to store the data. The application is deployed in a Docker container, which has to be hosted in a server.\n\n## Main functionalities\nThe application is designed to be used by the laboratory staff, who can create new batteries and experiments, as well as visualize the data of the experiments in a graph. It is necessary to use some software to execute the queued created experiments and write its result data in the database. If this cycler software is different from [Battery-Cyclers-Controler](https://github.com/WattRex/Battery-Cyclers-Controler/), the obtained data could be prepared to be imported in the application as a new finished experiment. The application allows to export the data in a CSV file and to generate a local html report of the experiments. On going experiments can be monitored in real time.\n\n### Monitor\nThe monitor is a page that allows to visualize the data of the on going experiments in real time. It is possible to select any of the cycler stations which are cycling a experiment (experiment status is 'RUNNING'). The data is updated, by default, every 5 seconds. The user can also select the time range of the data to be displayed (last 1, 5, 15, etc minutes). The data is displayed in a graph, which can be zoomed in and out, and retrieved . The user can also download the data in a CSV file. It is possible to know the instructions that the cycler is executing at that moment.\n\n### Experiments\nThe experiments page shows a list of all the experiments that have been created displayed as table. The user can sort the experiments by any of the columns (ID, name, status, dates, etc). For each experiment, the user can generate a preview page of experiment's info and data, download a local html report or export the data in a CSV file. The user can also filter the experiments by selecting the technology, battery, cycler station or profile used in the experiment. It is also possible to search for some text in the name or description of the experiment.\n\n### Add battery\nThe add battery page allows to create a new battery. The user has to select and write all the fields that define a battery depending on its selected technology. If the battery is created successfully, the user will be redirected to the experiment page to create a new experiment.\n\n### Add experiment\nThe add experiment page allows to create a new experiment. The user has to select the technology, battery, cycler station and profile to be used in the experiment and write a name and description for it. The compatible profiles are loaded to be selected when user has specified the battery and cycler station for the experiment. The profile can also be written or uploaded by the user, and it is verified before the experiment is uploaded to database. If the experiment is created successfully, the user will be redirected to the monitor page.\n\n### Import experiment\nThe import experiment page allows to import a new experiment from a CSV file. The user has to select the file and write a name and description for the experiment. The file is verified before the experiment is uploaded to database. If the experiment is created successfully, the user will be redirected to the experiments page.\n\n## Structure and initialization\nThe application is divided in 3 containers: the web server, the database and the master node manager. The web server is based on the [Django framework](https://www.djangoproject.com/), which is a Python framework that allows to develop web applications following the MVC architecture. The database is based on [MySQL](https://www.mysql.com/), which is a relational database management system. Both services are deployed in [Docker](https://www.docker.com/) containers, which have to be hosted in a server. The web server docker container uses a [Python image pregenerated from docker hub](https://hub.docker.com/_/python) as base to create the final image, adding: custom files, installing requirements, etc. The database docker container uses a [MySQL image pregenerated from docker hub](https://hub.docker.com/_/mysql) and only a custom .sql script file to initialize the database but it is provided in the final steps. To deploy the images in container with Docker, it used a [docker-compose.yml](https://docs.docker.com/compose/compose-file/) file, which is a file that allows to configure and run multiple containers. In this `docker-compose.yml` file is where the credentials of the database and web server are provided using a `.cred.env` file stored in the same folder as the `docker-compose.yml` file. The `.cred.env` file is not provided in this repository because it contains sensitive information and it has to be created by the user. The master node manager is a container that is used to manage the communication between web_server/database and the cycler software of each computational unit.\n\n## Instructions to deploy the application\nFirst of all, it is necessary to clone or download this repository in the server where the application will be deployed. Then, it is necessary to create the `.cred.env` file in the devops folder of the repository. The `.cred.env` file has to contain the credentials of the database and web server. The credentials of the database are the same as the ones used to connect to the database from the cycler software. The `.cred.env` file has to be written as follows:\n```\n# MYSQL Environment variables used by the database container to create the database and user\nMYSQL_DATABASE=wattrex_db       #Name of the database\nMYSQL_USER=user                 #User of the database\nMYSQL_PASSWORD=pass             #Password of the user of the database\nMYSQL_ROOT_PASSWORD=toor        #Password of the root user of the database\ndefault-character-set=utf8      #Character set of the database\n\n# DJANGO DATABASE CONNECTION PARAMETERS (used by the web server and they have to be the same as the ones used by the cycler software and database)\nDJANGO_DB1_database=wattrex_db  \nDJANGO_DB1_user=user\nDJANGO_DB1_password=pass\nDJANGO_DB1_default-character-set=utf8   \nDJANGO_DB1_host=192.168.0.88            #IP of the server where the database is hosted\nDJANGO_DB1_port=3369                    #Port of the database specified in the docker-compose.yml file\nSECRET_KEY=eXaMpLe_SeCrEtKeY!           #Secret key used by Django to encrypt the data\n```\n\nOther files that are necessary to deploy the application are the `.cred.yaml`, `log_config.yaml` and `config_params.yaml` files. The files `.cred.yaml` and `log_config.yaml` have to be stored inside the folder called mn_manager inside the devops folder. Both files are used inside the master node manager container. The `config_params.yaml` file has to be stored inside the devops folder. Those files have to be written as follows:\n\n`.cred.yaml`\n```\n---\n\nmaster_db:\n  user: ?\n  password: ?\n  host: ?.?.?.?\n  port: ?\n  database: ?\n  engine: mysql\n\nmqtt:\n  user: ?\n  password: ?\n  host: ?.?.?.?\n  port: 1883\n```\n\n`log_config.yaml`\n```\n---\n__main__: \"INFO\"\n\n##### DEV ######\nwattrex_mn_manager: \"INFO\"\nwattrex_driver_mqtt: \"INFO\"\nwattrex_driver_db: \"INFO\"\n\n##### DRV ######\ncan_sniffer: \"INFO\"\nscpi_sniffer: \"INFO\"\ndrv_flow: \"INFO\"\n\n##### SYS #####\nsys_abs.sys_conf: \"ERROR\"\nsystem_logger_tool: \"ERROR\"\nsystem_shared_tool: \"ERROR\"\n\nfile_handlers: {}\n```\n\n`config_params.yaml`\n```\n---\n\nsystem_shared_tool:\n  DEFAULT_CHAN_NUM_MSG: 350\n  DEFAULT_IPC_MSG_SIZE: 350\n  DEFAULT_CHAN_TIMEOUT: 1\n```\nBefore deploying the application, it is necessary to have access to some MQTT broker with the credentials specified in the `.cred.yaml` file. Otherwise, the master node manager container will not work properly.\n\nIf you already have any service running in the ports 8869 or 3369, you should change those ports in the `docker-compose.yml` file and update those changes in the credential files.\nAfter this previous steps, it is necessary to execute the following command (using the docker compose plugin) in the root folder of the repository to launch the containers:\n```\ndocker compose up -d\n```\nWhen the containers are running for the first time, the database container will create a docker volume to store the data and will execute the `.sql script` file to create the database and user. Then, the web server will try to connect to the database but it will fail because the database is not ready yet. It is necessary to wait until the database is ready and then restart the web server container. To restart the web server container, it is necessary to execute the following command:\n```\ndocker restart wattrex_web_server\n```\nThe master node manager container should be running at this point because it restarts until the database container is working properly. If it is not running when database and web are working, it is necessary to execute the following command:\n```\ndocker restart wattrex_mn_manager\n```\n\nNow, the application should be running and it should be possible to access to it using the IP of the server and the port 8869. If you want to stop the containers, you can execute the following command in the root folder of the repository (where the `docker-compose.yml` file is located):\n```\ndocker compose down\n```\n\n## Development process\nThe main development steps of the application are described in the [django_docker_dev_process.md](./django_docker_dev_process.md) file. Be careful because **the file is not updated with the last changes of the application** and it represents the development process of the first version of the application.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwattrex%2Fbattery-experiments-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwattrex%2Fbattery-experiments-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwattrex%2Fbattery-experiments-manager/lists"}