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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pht_station-0.2.2.tar.gz
  • Upload date:
  • Size: 111.2 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.2.tar.gz
Algorithm Hash digest
SHA256 8dfdb1b89b1edf71703006f3d3f5355f0c68ff0dc3ca8d8224e053bd74f870bd
MD5 a74ca3499596603250e5fcbd7f5a022d
BLAKE2b-256 31fac61983e67366f85d275a49f1ccfffbc08284896ff96d0fc400b28226ebd6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pht_station-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4551721fcb681122d23b8d349e57bb0d104d78063659c1b85c20b207f9f59fb
MD5 2fdefcad9c1966638e78d4e46d01dfb3
BLAKE2b-256 93a3efd1fde91e9929e0609fb02ba22081a39f9a18e729599018aecc7c32926c

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