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 #389

Closed jschalk closed 5 days ago

jschalk commented 5 days ago

Summary by Sourcery

Refactor the translation handling in the pidgin module by introducing new bridge classes for group, account, and road translations. Update the PidginUnit class to utilize these new classes, enhancing modularity and maintainability. Replace the get_create_inx method with reveal_inx for improved clarity. Add comprehensive tests for the new classes and update existing tests to align with the refactored code.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 5 days ago

Reviewer's Guide by Sourcery

This pull request refactors the pidgin translation system by splitting the BridgeUnit class into specialized bridge classes (GroupBridge, AcctBridge, RoadBridge) and updating the PidginUnit class to use these new bridge types. The changes improve code organization and maintainability by separating concerns into distinct classes.

Class diagram for updated PidginUnit and Bridge classes

classDiagram
    class PidginUnit {
        TimeLinePoint event_id
        OwnerID face_id
        dict[str, BridgeUnit] bridgeunits
        GroupBridge groupbridge
        AcctBridge acctbridge
        RoadBridge roadbridge
        str unknown_word
        str otx_wall
        str inx_wall
        +set_groupbridge(GroupBridge)
        +get_groupbridge() GroupBridge
        +set_group_id(str, str)
        +group_id_exists(str, str) bool
        +_get_inx_group_id(str) str
        +del_group_id(str)
        +set_acctbridge(AcctBridge)
        +get_acctbridge() AcctBridge
        +set_acct_id(str, str)
        +acct_id_exists(str, str) bool
        +_get_inx_acct_id(str) str
        +del_acct_id(str)
        +set_roadbridge(RoadBridge)
        +get_roadbridge() RoadBridge
        +set_road(str, str)
        +road_exists(str, str) bool
        +_get_inx_road(str) str
        +del_road(str)
        +set_bridgeunit(BridgeUnit)
        +get_bridgeunit(str) BridgeUnit
        +is_valid() bool
        +set_otx2inx(str, str, str)
        +get_dict() dict
        +get_json() str
    }

    class BridgeUnit {
        dict otx2inx
        str unknown_word
        str otx_wall
        str inx_wall
        dict nub_label
        str jaar_type
        OwnerID face_id
        +set_all_otx2inx(dict, bool)
        +set_otx2inx(str, str)
        +_get_inx_value(str) str
        +reveal_inx(str, bool) str
        +_reveal_roadunit_inx(str) RoadUnit
        +_get_nub_roadnode(RoadNode) RoadNode
        +otx2inx_exists(str, str) bool
        +otx_exists(str) bool
        +del_otx2inx(str)
        +set_nub_label(RoadNode, RoadNode)
        +_set_new_nub_label_to_otx_inx(str, str)
        +_get_nub_inx_label(RoadNode) RoadNode
        +nub_label_exists(RoadNode, RoadNode) bool
        +nub_otx_label_exists(RoadNode) bool
        +del_nub_label(RoadNode) bool
        +_unknown_word_in_otx2inx() bool
        +_otx_wall_in_otx_words() bool
        +_inx_wall_in_otx_words() bool
        +_otx_wall_in_inx_words() bool
        +_inx_wall_in_inx_words() bool
        +_is_otx_wall_inclusion_correct() bool
        +_is_inx_wall_inclusion_correct() bool
        +all_otx_parent_roads_exist() bool
        +is_valid() bool
        +get_dict() dict
        +get_json() str
    }

    class GroupBridge {
        +set_otx2inx(str, str)
        +otx2inx_exists(str, str) bool
        +_get_inx_value(str) str
        +del_otx2inx(str)
    }

    class AcctBridge {
        +set_otx2inx(str, str)
        +otx2inx_exists(str, str) bool
        +_get_inx_value(str) str
        +del_otx2inx(str)
    }

    class RoadBridge {
        +set_otx2inx(str, str)
        +otx2inx_exists(str, str) bool
        +_get_inx_value(str) str
        +del_otx2inx(str)
    }

    PidginUnit --> BridgeUnit
    PidginUnit --> GroupBridge
    PidginUnit --> AcctBridge
    PidginUnit --> RoadBridge
    BridgeUnit <|-- GroupBridge
    BridgeUnit <|-- AcctBridge
    BridgeUnit <|-- RoadBridge

File-Level Changes

Change Details Files
Split BridgeUnit into specialized bridge classes with shared core functionality
  • Created BridgeCore class to share common bridge functionality
  • Created GroupBridge class for group ID translations
  • Created AcctBridge class for account ID translations
  • Created RoadBridge class for road translations
  • Moved common bridge functionality to BridgeCore class
src/f08_pidgin/bridge_new.py
src/f08_pidgin/bridge_old.py
Updated PidginUnit to use new specialized bridge classes
  • Added groupbridge, acctbridge, and roadbridge attributes
  • Added methods for managing group IDs
  • Added methods for managing account IDs
  • Added methods for managing roads
  • Updated error messages to reference BridgeCore
src/f08_pidgin/pidgin.py
Added database support for new bridge types
  • Created br00042AbstractTable for group bridges
  • Created br00043AbstractTable for account bridges
  • Added corresponding hold and stage tables
  • Updated brick format configuration files
src/f09_brick/brick_models.py
src/f09_brick/brick_formats/brick_format_00042_bridge_group_id_v0_0_0.json
src/f09_brick/brick_formats/brick_format_00043_bridge_acct_id_v0_0_0.json
Added comprehensive test coverage for new bridge classes
  • Added tests for GroupBridge functionality
  • Added tests for AcctBridge functionality
  • Added tests for RoadBridge functionality
  • Added tests for PidginUnit integration with new bridge types
src/f08_pidgin/test_pidgin/test_bridge_group.py
src/f08_pidgin/test_pidgin/test_bridge_acct.py
src/f08_pidgin/test_pidgin/test_bridge_road.py
src/f08_pidgin/test_pidgin/test_pidginunit_crud_group.py
src/f08_pidgin/test_pidgin/test_pidginunit_crud_acct.py
src/f08_pidgin/test_pidgin/test_pidginunit_crud_road.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).