Skip to content

technologiestiftung/innovationserhebung

Repository files navigation

Technologiestiftung Berlin pre-commit.ci status

Innovationsdaten

This informational long-read is a digital version of the study "Innovationserhebung" which is conducted by the Technologiestiftung Berlin in german language. The study takes a look into data about business innovation since 2012 and was released in a print version since then.

The digital version now enhances the findings and data with interactive charts to enable viewers to find even more customised insights. The data of the study is based on the yearly published Innovationserhebung by the ZEW - Zentrum für Europäische Wirtschaftsforschung.

Installation guide

Prerequisites

  • Latest Python 3.11 version (i.e. 3.11.4, other versions might work as well) – You can e.g. use pyenv, see below.
  • A Node version that’s defined in .nvmrc – You can e.g. use nvm to switch to the right version (with nvm use or nvm install).

General setup

  1. Create a .env file by copying the .env.example file and filling out the variables.
  2. Install npm dependencies:
    npm install
  3. Run the get-fonts script to download the required font files (they will be placed in the /app/static/fonts directory):
    npm run get-fonts

Set your virtual environment

The following steps are not required but recommended. This will allow you to install packages in your isolated virtual environment instead of globally, reducing the risk of breaking system tools or other projects.

  1. Install pyenv and the pyenv-virtualenv plugin.
  2. Download the appropriate Python version with
pyenv install 3.11.4

in the command line. 3. Create a virtual environment with the appropriate Python version and name for your environment, for example

pyenv virtualenv 3.11.4 innovationserhebung
  1. Activate the environment with
pyenv activate innovationserhebung

Install Python requirements and pre-commit

Install the required libraries with the command line

pip install -r requirements.txt -r requirements-dev.txt

Install the pre-commit git hook

pre-commit install

Run the APP

  1. Run the server with the command line
uvicorn app.main:app --reload
  1. Your terminal should show something like:
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Changing HTML & CSS

If you need to change HTML templates or CSS, you should use the Tailwind watcher to automatically recompile the CSS:

  1. Move to the root directory
  2. Start the tailwind watcher:
    npm run dev:tailwind

Run server in development mode

  1. After setting up the project according to the previous chapters, run
$ chmod +x run_dev.sh

from your root directory to give the bash file executable permission.

  1. Now you should be able to start a development server via
./run_dev.sh

This also runs the tailwind watcher

Convert the source XLSX data source to JSON

Taking an input XLSX file similar to the one in this repository, you can convert it to JSON by running

python -m app.xlsx2json

Handling & updating requirements

We are using pip-tools to handle the requirements and keep the dependencies updated.

In case you are updating or adding some dependencies, do so in the requirements.*.in files and don't forget to compile the new requirements.*.txt files running:

pip-compile requirements.in
pip-compile requirements-dev.in

To update the packages, following the version pinning defined in the requirements*.in files, run:

pip-compile --upgrade requirements.in
pip-compile --upgrade requirements-dev.in

To keep your environment in sync, run:

pip-sync requirements.txt requirements-dev.txt

Deployment

To deploy the app, these commands should be run (in the root directory) to build the app:

pip install -r requirements.txt && npm install && npm run build

Afterwards, the app can be started with these commands:

uvicorn app.main:app --host 0.0.0.0 --port $PORT

These environment variables should be set:

Variable Value
FONTS_URL
PORT 8000
PYTHON_VERSION 3.11.4

Content Licencing

Texts and content available as CC-BY-SA.

Credits

A project by:

Supported by: