Skip to main content

Python library for handling containerized PHT trains

Project description

Build Tests codecov

PHT Station Backend

This project contains the implementation of the station API, workers for training models, as well as the configuration for the station airflow instance and related workers. A FastAPI REST API als well as a command line tool for train and station management can be found in the station directory.

Setup development environment

Checkout the repository and navigate to project directory.

git clone https://github.com/PHT-Medic/station-backend.git
cd station-backend

Prerequisites

Make sure the following ports required for the services are open or change the port mappings in the docker-compose.yml file.

  • Postgres: 5432
  • Redis: 6379
  • Minio: 9000 & 9001 (Console)
  • Airflow: 8080
  • Blaze FHIR server: 9090
  • API: 8000

Start services

Start the services for development using docker-compose.

docker compose up -d

Check the logs of the services to see if everything is running as expected.

docker compose logs -f

Configure station config for running the API in development mode

Copy the station_config.yml.tmpl file in the root directory to station_config.yml and adjust the values (especially configuring addresses and credentials for the central api)

# Configure authentication for central services
central:
  api_url: ""
  # Robot credentials for accessing central services, these can be obtained in the central UI
  robot_id: "central-robot-id"
  robot_secret: "central-robot-secret"
  private_key: "/path/to/private_key.pem"
  # optional password for private key
  private_key_passphrase: "admin"

######### some lines omitted #########

# Configures the address and credentials for the central container registry
registry:
  address:
  password:
  user:
  project:

Install python dependencies

Install dependencies using poetry. This will also create a virtual environment for the project.

poetry install --with dev

Run the station API

To run the station API with hot reloading, run the following command:

poetry run python station/app/run_station.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pht_station-0.2.1.tar.gz (111.1 kB view details)

Uploaded Source

Built Distribution

pht_station-0.2.1-py3-none-any.whl (160.8 kB view details)

Uploaded Python 3

File details

Details for the file pht_station-0.2.1.tar.gz.

File metadata

  • Download URL: pht_station-0.2.1.tar.gz
  • Upload date:
  • Size: 111.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for pht_station-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2969c7986da1134f7212dcb9316b12e8cdc5ce5b090d7a24f0ad32ff17145414
MD5 aafb97d30de086556e32c979635fbbdf
BLAKE2b-256 5223bdb66692b479bb34c0406525c5eb0cb7c26083ffdb01df6263744648793c

See more details on using hashes here.

File details

Details for the file pht_station-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pht_station-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 160.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for pht_station-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2215628fad4f19967e0afb25e0f5358c5d31e9895d3b480f65a213ca089ea09
MD5 926f6020c3402e337c2614e672d79b65
BLAKE2b-256 038e2df984a956d904e4719ced9f173a0118b3ab700721df7ba03b1c027032a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page