How maciejgornicz/ifirma_docs works
Project Type and Purpose
• This is a microservice application named “ifirma-docs” designed to automate the uploading of scanned documents to an ifirma.pl user account.
• It does not use an official API; instead, it automates tasks by driving a Chrome browser through Selenium.
• It is built with Python (3.11) and containerized with Docker (using docker-compose). There’s also an FTP service provided for incoming scanned documents.
Analyzing the File Structure
• Top-level components: There are configuration and environment files (Dockerfile, docker-compose.yaml, Makefile, env folder), source code within “src”, and unit tests under “tests”.
• In “src”, the project is organized into a config directory (with config.yaml) and a modules directory that encapsulates different functionalities (e.g., health check, logger, settings, uploader).
• The main entry point (src/main.py) likely orchestrates the service functions, tying together configuration, monitoring of the FTP folder, and triggering the Selenium-driven upload process.
• The Docker-related files (.github workflows, Dockerfile, docker-compose) indicate that this service is meant to run in a containerized environment with linked external services (FTP, Selenium Chrome service).
Key Components
a. ifirma-docs Microservice:
• Ifirma-docs service as a central component, outlining its responsibilities: monitoring a shared directory for new files, invoking the Selenium Chrome service to perform document upload tasks, and performing logging and settings management.
b. FTP Service:
• A “Simple FTP Service” as an external component. It acts as a drop point where scanned files are uploaded and later picked up by the ifirma-docs service.
• Default credentials (user: user, pass: 123) in annotations if needed.
c. Selenium Chrome Browser Service:
d. Configuration & Environment:
• Use of Docker and docker-compose, which tie all components together in an orchestrated containerized solution.
• You could highlight configuration files (like the YAML config in “src/config”) and environment files, which define runtime behavior and staging (test/prod) differences.
Relationships and Interactions
• Data flows from the FTP Service (where scanned document files are deposited) to the ifirma-docs service.
• The ifirma-docs service, upon detecting new files, interacts with the Selenium Chrome Service to perform the browser-driven upload.
• Optionally, indicate feedback loops like logging and health checking back to a monitoring or logging infrastructure.
Architectural Patterns and Design Elements
• Microservice approach—each external service (FTP, Selenium Chrome) is containerized and managed via docker-compose.
• Separation of concerns within the ifirma-docs service (dividing responsibilities using internal modules).
• Use of automation (e.g., Selenium) in the absence of a formal API, which is an interesting design point.