PASTA-ELN / pasta-eln

PASTA-ELN with new frontend
https://pasta-eln.github.io/pasta-eln/
Other
8 stars 2 forks source link

fix bug of 253 #345

Closed enmar-alkhafagi closed 1 month ago

enmar-alkhafagi commented 1 month ago

Summary by Sourcery

Replace the CouchDB backend with a new SQLite-based implementation, introducing advanced extractor tutorials and enhancing the GUI with a slide show feature. Improve testing infrastructure and update CI workflows to support multiple Python versions. Remove obsolete CouchDB-related files and update documentation to reflect these changes.

New Features:

Bug Fixes:

Enhancements:

Build:

CI:

Deployment:

Documentation:

Tests:

Chores:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements a major refactoring of the PASTA-ELN project, transitioning from CouchDB to SQLite as the backend database. The changes are extensive, affecting nearly all parts of the codebase, including the core backend functionality, GUI components, installation process, and testing suite.

Class diagram for the refactored serverActions module

classDiagram
    class Backend {
        +checkDB(outputStyle: str, repair: bool)
        +db: SqlLiteDB
    }
    class SqlLiteDB {
        +basePath: Path
        +saveDoc(doc: dict)
        +remove(docID: str)
        +cursor: Cursor
        +connection: Connection
    }
    class serverActions {
        +couchDB2SQLite(userName: str, password: str, database: str, path: str)
        +translateDoc(doc: dict, comment: str) : tuple
        +translateV2_V3(path: str)
        +verifyPasta(projectGroup: str, repair: bool)
        +repairPropertiesDot(projectGroup: str)
        +delete(projectGroup: str, docID: str)
        +__returnBackend__(projectGroup: str) : Backend
    }
    Backend --> SqlLiteDB
    serverActions --> Backend
    serverActions --> SqlLiteDB

Class diagram for the refactored form module

classDiagram
    class Form {
        -comm: Communicate
        -doc: dict
        -flagNewDoc: bool
        -skipKeys: list
        -allHidden: bool
        -allUserElements: list
        +autosave()
        +execute(command: list)
        +textChanged()
        +delTag(_: str, tag: str)
        +addTag(tag: Union[str, int])
        +updateTagsBar()
    }
    class Communicate {
        +backend: Backend
    }
    Form --> Communicate
    Form --> Backend

Class diagram for the refactored installationTools module

classDiagram
    class installationTools {
        +getOS() : str
        +createDefaultConfiguration(pathPasta: Optional[Path]) : dict
        +configuration(command: str, pathData: str) : str
        +exampleData(force: bool, callbackPercent: Optional[Callable], projectGroup: str, outputFormat: str) : str
    }
    class Backend {
        +addData(docType: str, data: dict, newProjID: list)
        +changeHierarchy(projID: str)
        +db: SqlLiteDB
    }
    installationTools --> Backend
    Backend --> SqlLiteDB

File-Level Changes

Change Details Files
Replaced CouchDB with SQLite as the backend database
  • Implemented new SqlLiteDB class to handle database operations
  • Updated all database queries and operations throughout the codebase to work with SQLite
  • Removed CouchDB-specific code and dependencies
pasta_eln/sqlite.py
pasta_eln/backend.py
pasta_eln/GUI/table.py
pasta_eln/GUI/project.py
Refactored data model and document structure
  • Updated document structure to use new field names (e.g., 'id' instead of '_id')
  • Modified how metadata and properties are stored and retrieved
  • Implemented new data hierarchy and definitions system
pasta_eln/fixedStringsJson.py
pasta_eln/handleDictionaries.py
pasta_eln/GUI/form.py
Updated installation and configuration process
  • Removed CouchDB installation steps
  • Updated configuration file structure and naming
  • Modified example data creation process to work with new backend
pasta_eln/installationTools.py
pasta_eln/GUI/configSetup.py
Refactored GUI components to work with new backend
  • Updated form handling and data display in various GUI components
  • Modified project tree view and hierarchy management
  • Implemented new palette system for theming
pasta_eln/GUI/details.py
pasta_eln/GUI/projectLeafRenderer.py
pasta_eln/GUI/palette.py
Updated and expanded test suite
  • Added new tests for SQLite backend functionality
  • Updated existing tests to work with new data model
  • Implemented new GUI tests using pytest-qt
tests/test_01_DefaultExample.py
tests/test_02_copyMove.py
tests/test_03_dragDrop.py
Refactored utility functions and string handling
  • Moved and updated various utility functions
  • Implemented new string manipulation functions
  • Updated logging and error handling throughout the codebase
pasta_eln/stringChanges.py
pasta_eln/miscTools.py
Updated extractor functionality
  • Modified extractor interface to work with new data model
  • Updated existing extractors (e.g., PNG, CSV, JSON) to use new style parameter
  • Improved extractor documentation and examples
pasta_eln/Extractors/extractor_png.py
pasta_eln/Extractors/extractor_csv.py
pasta_eln/Extractors/extractor_json.py

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
SteffenBrinckmann commented 1 month ago

Tried to merge into main, error