Merry Christmas from Rossum!
This simple project demonstrates how Rossum can be used not only as a data extraction tool but also as an integration between various tools and technologies.
We want to prepare a simple document, which Rossum should be able to extract message from, and send it to our display device at home using its awesome hook mechanism.
We're gonna build a simple stack using a various option of technologies
- Wemos D1 mini as a server displaying message on a display
- SSD1306 OLED display to display our message
- fast-api server as a bridge between ngrok and our local display
- ngrok to be able to access our local server from the internet
- Rossum to extract data from
.docx
file (yes, Rossum is able to process MS Word and Excel documents as well 🚀) and display message on our display using its amazing hook functions
First we need to prepare our esp-8266 to be able to display our message.
-
we will need a Wemos D1 mini board and a SSD1306 OLED display
-
we need to flash micropython firmware to our wemos d1 mini (more here)
-
download the newest firmware here
-
install
esptool
python3 -m pip install esptool
-
erase flash of your d1 mini
esptool.py --chip esp8266 erase_flash
-
install the latest firmware
esptool.py --port /dev/cu.usbserial-110 --baud 460800 write_flash --flash_size=detect 0 esp8266-20210902-v1.17.bin
-
connection
SSD1306 Wemos D1 mini GND GND VCC 5V SCL D1 SDA D2 -
we need to prepare a configuration file
wemos_display/configuration.py
based on configuration template- if you're using the same display - SSD1306 you should follow
WIFI_CREDENTIALS = { "ssid": "...", "password": "...", "hostname": "RossumDisplay", } I2C_PINS = { "sda": 4, # D2 "scl": 5, # D1 } DISPLAY_RESOLUTION = (128, 64)
fill in
WIFI_CREDENTIALS
based on your configuration -
boot.py is run on d1 startup and creates local Wi-Fi connection
-
display.py is a simple module handling our display
-
main.py defines a simple http server listening on
80
port for anyhttp GET
request with?text=...
in its path -
the simplest way how to load
.py
files to d1 mini is using PyCharm's micropython plugin
Since most of people does not have a private IP we need to create another http server that will be made public using ngrok.com and will simply call our d1 mini
- requirements.txt defines the only two dependencies our simple server has (
fastapi
anduvicorn
) - main.py defines a light-weight Fast-API server that accepts
HTTP POST
request and converts it toHTTP GET
request sent to our d1 mini - to start the server simply run
python3 -m pip install -r requirements.txt uvicorn main:app --reload
- download ngrok
- run
ngrok http 8000
to make our fast-api app public (make note of the displayed URL - in our casehttps://82dd-2a00-1028-8392-1dea-d875-b857-3121-5883.ngrok.io
)
- visit rossum-elis
- update queue schema according to schema.json (it creates 3 string fields:
address
(url of our ngrok server),local_address
(local address of our d1 mini server),text
(text message to display on our display)) - create function extension attached to the queue with updated schema
- set the trigger event
document content - export
- update function code according to function.py
- create a
merry_christmas.docx
file with following fields
- upload the MS Word file to your Rossum queue
- click on your Christmas document
- make sure the bounding boxes cover your texts
- click the Confirm button
- the document gets exported
- you should see the message on your display! 🎉
Now that we have working prototype we can use 3D printer and create a case for our device There are several cases on thingiverse we could use e.g. this one