Skip to content

Conversation

@antidodo
Copy link
Member

This pull request refactors the FlameCoreSDK class to streamline logging, improve error handling, and integrate a new PO service connection. It removes the silent parameter from many methods, consolidates logging through the new FlameLogger class, and adds robust startup checks. Additionally, it ensures all service APIs receive the logger for consistent output and error management.

Logging and error handling improvements:

  • Replaced the legacy flame_log and declare_log_types functions with the new FlameLogger class, updating all logging calls to use the instance logger and removing the silent parameter throughout the codebase. Improved error reporting now uses raise_error and logs exceptions with repr(e) for clarity. ([[1]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aR13-L81), [[2]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL221-R271))
  • Updated all service API initializations (MessageBrokerAPI, StorageAPI, DataAPI) to accept and use the new logger, ensuring consistent logging across services. ([flamesdk/flame_core.pyR13-L81](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aR13-L81))
  • Removed the silent parameter from methods such as send_message, save_intermediate_data, submit_final_result, and others, simplifying the method signatures and internal logic. ([[1]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL156-R173), [[2]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL208-R224), [[3]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL276-L285), [[4]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL321-R329), [[5]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL331-R345), [[6]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL393-R396), [[7]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL405-R446), [[8]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL487-R476), [[9]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL505), [[10]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL523-L524), [[11]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL538-R523))

Service connection and startup logic:

  • Added connection logic for the new PO service (POAPI), including error handling and logger integration. Startup now explicitly checks that all services are connected before setting the SDK status as ready, otherwise logs a startup failure. ([flamesdk/flame_core.pyR13-L81](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aR13-L81))
  • Improved error handling during service startup, ensuring that failures in any service connection are logged as errors and the SDK does not falsely report readiness. ([flamesdk/flame_core.pyR13-L81](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aR13-L81))

Data conversion and API integration:

  • Updated the fhir_to_csv method to use the logger and check for the presence of the data API before attempting conversion, logging a warning if unavailable and returning None. ([[1]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL276-L285), [[2]](https://github.com/PrivateAIM/python-sdk/pull/9/files#diff-fac0746a70b997ed1b8e7d22e3ef66aa87bf4afab673175da0e7a6d8fa8bdc6aL296-R320))

These changes improve maintainability, error visibility, and reliability of the SDK during initialization and runtime.

antidodo and others added 23 commits August 7, 2025 10:27
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
…timeout for log streaming

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
…timeout for log streaming

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
…ialization

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
…g method

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
… updating error handling

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
…ting POAPI interaction

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
Co-authored-by: antidodo <albin2993@gmail.com>
… errors

Co-authored-by: Nightknight3000 <alexander.roehl@uni-tuebingen.de>
@antidodo antidodo merged commit e0d7a37 into main Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants