time-link / timelink-py

Timelink Python Package
MIT License
3 stars 0 forks source link

the_type element not set in groups extending historical-act #48

Closed joaquimrcarvalho closed 1 month ago

joaquimrcarvalho commented 1 month ago

Exported data should the the_type element set to the group name. This works for "lista" but not for others, like "carta"

joaquimrcarvalho commented 1 month ago

In fact exported data for carta contains the "type" element correctly set.

The reason it does not show in the "acts" table is that "lista" does not introduce a mapping to a specific table, and entities recorded as "lista" go to the generic "acts table directly. While "carta" introduces its own mapping to table "cartas" where there is no mapping for "type".

It is questionable if the value of "type" should not go to the table "acts" which "cartas" extends. This looks like a bug in the POM_SOM mapping algorithm.

joaquimrcarvalho commented 1 month ago

This happens because the method group_to_entity uses the list of columns in the PomSomMapper to fetch the elements of the group and set them in the ORM Model. Since "Carta" does not include "the_type" it is not fetched.

The best way would be to inspect the ORM Model to obtain the columns and then use the PomSomMapper hierarchy to find the element name equivalent to each column and fetch the element from group.

  1. PomSomMapper needs to collect all the class_attributes up in the hierarchy.
  2. KGroup.get_element_for_column() ignores PomSomMapper maybe the method would make more sense in PomSomMapper because KGroup has no access to the db.
joaquimrcarvalho commented 1 month ago

fixed in 1.1.12