Scripts to obtain A3 data, transform it into iMarina load format, and upload it to iMarina server using SFTP
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Follow these steps to set up the project locally.
Install Python version 3.12.3 or above, git and other essentials for building the project.
In Ubuntu is:
sudo apt install python3.12-venv gcc build-essential git -ygit clone https://github.com/ICIQ-DMP/iMarina-load.gitcd iMarina
make installFirst you will need to obtain the spreadsheets with the translations. By default, they are read from the input/
folder, but
you can change the location of these expected files with the following arguments:
--imarina-input /path/to/iMarina.xlsx--a3-input /path/to/A3.xlsx--countries-dict /path/to/countries.xlsx--jobs-dict /app/input/Job_Descriptions.xlsx
You can either download them manually from Sharepoint, or you can use the Dockerized OneDrive service to sync files from Sharepoint to your host computer automatically in the background.
To do so you should do the following:
cd services/onedrive
bash run.sh
# The program will display a link and ask you to authenticate and paste the answered URL into the terminalInstitutional Strengthening/_Projects/iMarina_load_automation/input from Sharepoint into services/onedrive/data. Add
or change the necessary arguments to read from this new source, instead of input/, so that data consumed by the
program is always updated.
You can leave OneDrive running so that the files are always in sync.
There are two configuration options active in services/onedrive/conf/config to make OneDrive delete things that have
been deleted in Sharepoint cleanup_local_files = "true" and to only do downloads, not uploads (one-way sync)
download_only = "true". You may remove these two options to change the behaviour from one-way sync to two-way sync.
To start the program execute this command:
./venv/bin/python src/main.py Use the provided Dockerfile and compose.yml to build and run the iMarina-load service in a containerized
environment.
Dockerfile Builds a lightweight Python 3.12 Alpine image that installs dependencies and
runs the main script with predefined input file paths.
compose.yml Defines a service that builds and runs the iMarina-load container, mounts input/output folders,
and securely injects FTP credentials as secrets for automated data processing.
First, you will need to create a .env file at the root of the project with the UID and GID of the user on your
host that looks like this:
UID=1015
GID=1015We used 1015 as example, but you can create a .env with the correct values with:
cat <<EOF > .env
UID=${UID:-$(id -u)}
GID=${GID:-$(id -g)}
EOFIn any case, you need to pass the variables UID and GID to docker compose to make it work.
To build the Docker image and run it you can use:
docker compose up --buildOther useful commands:
sudo docker build . -t aleixmt/imarina-load --progress=plain docker compose run --rm app shInstall the requirements-dev.txt to install the dependencies for the tests.
make devWe have to be at the root of the project, otherwise we will get an error
cd ~/Desktop/iMarina-loadAfter that, we can use this to run all tests at the same time:
pytest -v- Display prints or logs during tests:
pytest -s -v- Stop at the first fail in the test:
pytest -x- Run specific tests for example (by name):
pytest -k "name"Run the following command to build the test image and execute the tests against it:
docker compose -f compose.yml -f compose.test.yml up --build Our project uses GitHub Actions to run the tests against every pushed commit to the master branch.
The workflow installs dependencies, runs all pytest tests, and builds the Docker image only if all tests pass.
The workflow is defined in .github/workflows/docker.yml
See the open issues for a full list of proposed features (and known issues).
Contributions are welcome and what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you’d like to report a bug, request a feature, or propose an improvement, please follow these steps:
Create a new Issue in here.
- Title: A short, descriptive summary of the issue.
- Description: Provide as much context as possible.
- For bugs: steps to reproduce, expected vs. actual behavior, environment (OS, Python version, etc.).
- For features: explain the motivation and the expected outcome.
- Screenshots or logs (if applicable).
The maintainers will review it and may ask for further clarification.
Fork the repository, implement the changes that you want on your fork and create a Pull Request in here.
The maintainers will try to integrate it into the master branch.
Distributed under the GNU GPL v3. See LICENSE for more information.
- Mario Piqué - mpique@iciq.es
- Aleix Mariné - amarine@iciq.es