jschalk / jaar

Cross-cultural communication engine built on customizable economic systems. Produces personalized agendas, calendars, finance reports for users.
0 stars 1 forks source link

175 enable documentation process #360

Closed jschalk closed 1 month ago

jschalk commented 1 month ago

Summary by Sourcery

Refactor the filtering and world management components by introducing the WorldUnit class and renaming BridgeUnit to FilterUnit. Enhance file handling with new utility functions and update tests to cover new functionalities. Add openpyxl to dependencies for Excel file handling.

New Features:

Enhancements:

Build:

Tests:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements significant refactoring and enhancement of the codebase, primarily focusing on renaming and restructuring filter-related functionality, adding new world management features, and improving file handling capabilities.

Class diagram for the updated filter module

classDiagram
    class FilterUnit {
        OwnerID face_id
        dict~str, BridgeKind~ bridgekinds
        str unknown_word
        str otx_road_delimiter
        str inx_road_delimiter
        +set_bridgekind(BridgeKind x_bridgekind)
        +get_bridgekind(str x_python_type) BridgeKind
        +is_valid() bool
        +set_otx_to_inx(str x_python_type, str x_otx, str x_inx)
        +_get_inx_value(str x_python_type, str x_otx) str
        +otx_to_inx_exists(str x_python_type, str x_otx, str x_inx) bool
        +del_otx_to_inx(str x_python_type, str x_otx)
        +set_explicit_label(str x_python_type, str x_otx, str x_inx)
        +_get_explicit_inx_label(str x_python_type, str x_otx) str
        +explicit_label_exists(str x_python_type, str x_otx, str x_inx) bool
        +del_explicit_label(str x_python_type, str x_otx)
        +get_dict() dict
        +get_json() str
    }

    class BridgeKind {
        dict otx_to_inx
        str unknown_word
        str otx_road_delimiter
        str inx_road_delimiter
        dict explicit_label
        str python_type
        OwnerID face_id
        +set_all_otx_to_inx(dict x_otx_to_inx, bool raise_exception_if_invalid)
        +set_otx_to_inx(str otx_word, str inx_word)
        +_get_inx_value(str otx_word) str
        +get_create_inx(str otx_word, bool missing_add) str
        +_get_create_roadunit_inx(RoadNode otx_road) RoadUnit
        +_get_explicit_roadnode(RoadNode x_roadNode) RoadNode
        +otx_to_inx_exists(str otx_word, str inx_word) bool
        +otx_exists(str otx_word) bool
        +del_otx_to_inx(str otx_word)
        +set_explicit_label(RoadNode otx_label, RoadNode inx_label)
        +_set_new_explicit_label_to_otx_inx(RoadNode otx_label, RoadNode inx_label)
        +_get_explicit_inx_label(RoadNode otx_label) RoadNode
        +explicit_label_exists(RoadNode otx_label, RoadNode inx_label) bool
        +explicit_otx_label_exists(RoadNode otx_label) bool
        +del_explicit_label(RoadNode otx_label)
        +_unknown_word_in_otx_to_inx() bool
        +_otx_road_delimiter_in_otx_words() bool
        +_inx_road_delimiter_in_otx_words() bool
        +_otx_road_delimiter_in_inx_words() bool
        +_inx_road_delimiter_in_inx_words() bool
        +_is_otx_delimiter_inclusion_correct() bool
        +_is_inx_delimiter_inclusion_correct() bool
        +all_otx_parent_roads_exist() bool
        +is_valid() bool
        +get_dict() dict
        +get_json() str
    }

    FilterUnit --> BridgeKind
    BridgeKind --> OwnerID
    BridgeKind --> RoadNode
    BridgeKind --> RoadUnit

Class diagram for the new WorldUnit class

classDiagram
    class WorldUnit {
        WorldID world_id
        str worlds_dir
        TimeLinePoint current_time
        dict~FaceID, FilterUnit~ faces
        dict~FaceID~ _faces_dir
        dict~TimeLineLabel, TimeConversion~ timeconversions
        set~FiscalID~ _fiscalunits
        +set_face_id(FaceID face_id, FilterUnit x_filterunit)
        +face_id_exists(FaceID face_id) bool
        +get_filterunit(FaceID face_id) FilterUnit
        +del_face_id(FaceID face_id)
        +del_all_face_id()
        +face_ids_empty() bool
        +_face_dir(FaceID face_id) str
        +save_filterunit_files(FaceID face_id)
        +face_dir_exists(FaceID face_id) bool
        +_set_all_face_ids_from_dirs()
        +_delete_filterunit_dir(FaceID face_id)
        +get_timeconversions_dict() dict~TimeLineLabel, TimeConversion~
        +load_filterunit_from_files(FaceID face_id)
        +get_dict() dict
    }

    class TimeConversion {
        str fiscal_id
        str addin
    }

    WorldUnit --> FilterUnit
    WorldUnit --> TimeConversion
    WorldUnit --> FaceID
    WorldUnit --> WorldID
    WorldUnit --> TimeLinePoint
    WorldUnit --> TimeLineLabel
    WorldUnit --> FiscalID

File-Level Changes

Change Details Files
Renamed BridgeUnit to FilterUnit and refactored related code
  • Renamed BridgeUnit class to FilterUnit for better clarity
  • Updated all references and imports to use FilterUnit instead of BridgeUnit
  • Refactored test files to reflect the new naming convention
  • Moved filter-related functionality to separate modules
src/f09_filter/filter.py
src/f09_filter/test/test_filterunit_.py
src/f09_filter/test/test_filterunit_dict.py
Added new WorldUnit functionality for managing world states
  • Implemented WorldUnit class with face management capabilities
  • Added methods for loading and saving filter unit files
  • Created new test files for WorldUnit functionality
  • Added TimeConversion and related time management features
src/f10_world/world.py
src/f10_world/test/test_world_.py
src/f10_world/test/test_world_json.py
Enhanced file handling and directory management
  • Renamed dir_files to get_dir_file_strs for better clarity
  • Added new file handling utilities for Excel files
  • Improved directory traversal and file management functions
  • Updated tests to reflect new file handling capabilities
src/f00_instrument/file.py
src/f00_instrument/pandas_tool.py
src/f00_instrument/test/test_file.py
Added configuration management improvements
  • Added brick configuration file and related functionality
  • Created new test files for brick configuration
  • Added TimeLineLabel and related timeline management features
src/f08_brick/brick_config.json
src/f08_brick/test_brick_config/test_brick_config_.py
src/f01_road/finance_tran.py

Possibly linked issues


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).