Infoboard System API The Infoboard System API is a RESTful API for remotelly controlling and managing EPD based information boards (Infoboards).

Infoboard System API

The Infoboard System API is a RESTful API for remotelly controlling and managing EPD based information boards (Infoboards). API also allows managing companies, users, locations, intalations and contents.

How to run API

  • run in VENV: python -m uvicorn app.main:app --reload --port=8900
  • run in DOCKER:
    • make dev or
    • docker-compose -f ./docker-compose.yaml up --build

Configuration

  • web port can be changed in .env file
  • allowed origins for CORS middleware can be changed in app/config.json file
  • for calendar content type rename credentials-default.json to credentials.json and fill with configured credentials from Google Workspace Credentials

Project structure

  • app
    • domain logic
  • app/components
    • content data loader (google calendar)
    • bitmap processor (bitmap tempaltes, transformation to binary)
  • app/model
    • CRUD controllers
  • app/model/objects
    • database - DB connection
    • models - ORM models (SQLAlchemy)
    • schemas - Pydantic models (Fast API)

Data model

Data model of Infoboard system: data_model

API endpoints

System supports CRUD endpoinds for:

  • company, user, location, infoboard, content, instalation,userLocation, infoboardContent Selected important endpoints: Method Endpoint Description
    POST /company creates company
    POST /company/{companyId}/infoboard creates infoboard for company
    POST /company/{companyId}/content creates content for company.
    POST /infoboardContent assign content to infoboard
    GET /infoboard/{id}/content retrieves transformed binary content

For more details run API and visit http://localhost:8900/docs

Content types

The system supports three types of content:

  • Custom content (image)
  • Google Calendar (calendar)
  • Price tag (price)

Custom content (image):

  • user can upload own image in base64 format
  • example of content structure:
    {
      "id": 197
      "name": "Custom content",
      "contentType": "image",
      "companyId": 13
      "data": {
          "image": "data:image/png;base64,..."
      }
    }

Google Calendar (calendar):

  • retrieves events from the provided calendarId
  • based on retrieved events and template prepares bitmap
  • example of content structure:
    {
      "id": 42,
      "name": "Calendar name",
      "contentType": "calendar",
      "companyId": 17,
      "data": {
          "calendarId": "cc47b78a12443e134fadb348d@group.calendar.google.com"
      }
    }
  • template design: calendar

Price tag (price):

  • allows user to enter product name, description, price, etc.
  • based on this information, the system prepares a price tag.
  • example of content structure:
    {
      "id": 567,
      "name": "Cenovka",
      "contentType": "price",
      "companyId": 23,
      "data": {
          "title": "Názov produktu",
          "subtitle": "Popis produktu",
          "quantity": "250 g",
          "ean": "5264642821637",
          "price": "17.49",
          "currency": "€",
          "applyDiscount": true
          "discount": "-50%",
          "originalPrice": "34.99",
      },
    }
  • template design: price

Supported Infoboards

Infoboard System API supports following Waveshare EPD displays: Display Resolution Colors
2.66inch E-Paper Module (B) 296x152 Red / Black / White
4.2inch E-Paper Display (C) 400x300 Yellow / Black / White
7.5inch E-Paper Display 800x480 Back / White
Contributors 1
Juraj Ďuďák 100.0%
Languages
  • Python [99.41%]
  • Dockerfile [0.29%]
  • Makefile [0.28%]
  • Shell [0.02%]
  • Created at 28.11.2022
    Last update 13.01.2025, 22:36:00