This repository provides the data server for the DataUSA website. It's based on LogicLayer, a framework based on FastAPI, which allows to setup modules to provide data through REST endpoints. Most of the data retrieval is done through tesseract-olap, a semantic layer library.
The project metadata and dependencies are declared in the pyproject.toml file.
To setup a virtual environment and start with local development, it's suggested to use uv:
uv venv --python 3.12 # create a virtual environment
uv sync --group dev # resolve and install dependenciesThen you can use uvicorn to run a development server:
uvicorn --log-config=./etc/logging.json --reload app:layerThe main entrypoint of the application is declared in the app.py file, and the ASGI server object is stored
All the required environment variables are declared in the app.py file.
You can declare them in your terminal session, or create a .env file and add the setting --env-file=.env to the uvicorn command.
Deployments are configured to be done via container image. Production images are built and deployed through workflows executed by Github Actions. You can use docker or podman to build the image in your local machine and ensure it works.
To build the image:
# NO ENV VARS AT BUILDTIME
docker build --tag datausa-tesseract:latest .To run the container:
docker run --rm --env-file=.env.local -p 7777:7777 datausa-tesseract:latest