OHDSI / PatientLevelPrediction

An R package for performing patient level prediction in an observational database in the OMOP Common Data Model.
https://ohdsi.github.io/PatientLevelPrediction
187 stars 88 forks source link

Code base refactor - Data class #469

Open lhjohn opened 3 months ago

lhjohn commented 3 months ago

This issue should be for discussing the requirements of a data class. Here is a preliminary list of requirements:

Functional Requirements:

Technical Requirements

Possible architecture:

classDiagram
    class Data {
        -.data
        -.meta_data
        -.backend: DataBackend
        +data()
        +metadata()
        +setBackend(backend: DataBackend)
        +load(file_path) : uses
        +save(file_path) : uses
        +to_ipc(ipc: IPC) : uses
        +from_ipc(ipc: IPC) : uses
    }

    class DataBackend {
        <<abstract>>
    }

    class DataBackend-Arrow
    class DataBackend-Andromeda
    class DataBackend-DataTable

    Data --> DataBackend
    DataBackend <|-- DataBackend-Arrow
    DataBackend <|-- DataBackend-Andromeda
    DataBackend <|-- DataBackend-DataTable

    class DataPersistence {
      <<abstract>>
      +load()
      +save()
    }

    class DataPersistence-LocalFile {
      +load(file_path)
      +save(.data, file_path)
    }

    class DataPersistence-Database {
      +load(connection_details)
    }

    class DataPersistence-Synthetic {
      +load()
    }

    Data --> DataPersistence
    DataPersistence <|-- DataPersistence-Database
    DataPersistence <|-- DataPersistence-LocalFile
    DataPersistence <|-- DataPersistence-Synthetic

    class IPC {
        <<abstract>>
        +doPut()
        +doGet()
        +doExchange()
    }

    class IPC-ArrowFlight
    class IPC-ArrowFeather
    class IPC-Andromeda

    IPC <|-- IPC-ArrowFlight
    IPC <|-- IPC-ArrowFeather
    IPC <|-- IPC-Andromeda

    Data --> IPC
    class PyData {
        +to_ipc(ipc: IPC)
        +from_ipc(ipc: IPC)
    }

    class RustData {
        +to_ipc(ipc: IPC)
        +from_ipc(ipc: IPC)
    }

    PyData --> IPC
    RustData --> IPC