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.0.tar.gz (113.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pht_station-0.2.0.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Windows/10

File hashes

Hashes for pht_station-0.2.0.tar.gz
Algorithm Hash digest
SHA256 eade6902b100e4607ebc11f8b8683725da9e5c74b48c0d35975b12b5a526d8b4
MD5 7775a903803877118500536da142bcf8
BLAKE2b-256 d397355ed715a9592e468b42f44ece7e6acf692662b311fbfa641f5d0b73f1b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pht_station-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 160.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Windows/10

File hashes

Hashes for pht_station-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af8faa05ca4f02fb21e065952ca3eba7957133702b8eb4edb19cdffa40df380d
MD5 5d05cbe10dd966fc3e17fa6121b8ee37
BLAKE2b-256 1b3ecf2820ba7113b454dfa737f9a705a528f2ac0af1b812ca4e237ae2828227

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