Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart 1 Improvements (t_type consistency and optimization strategy) #93

Merged
merged 6 commits into from
Jun 5, 2024

Conversation

signedav
Copy link
Member

@signedav signedav commented May 22, 2024

t_type Field

Get possible values for t_type value relation for gpkg and mssql.

This is done over the t_ili2db_column_prop table, where the values are provided for every system.

With PG it used to parse the check constraint for that in get_value_map_info, not sure if this becomes obsolete now, but I keep it for the moment.

Where this functionality is implemented claeis/ili2db#241
Where it was implemented differently for pg opengisch/QgisModelBaker#389
Where it has been discussed opengisch/QgisModelBaker#134

And this here resolves opengisch/QgisModelBaker#797

Beautify naming

Since the value in t_type used to be an sql-table name describing the class (but neither an existing table (because it's not created with smart1) nor a proper ili-name), it's now displayed as the Ili-Element-name.

image

Optimize Strategy

With Smart1 a strategy named GROUP makes no sense: There is HIDE or NONE, while HIDE hides all the irrelevant values for t_type and provides only the relevant baskets.

@signedav signedav marked this pull request as ready for review May 30, 2024 07:00
@signedav signedav requested a review from gacarrillor May 30, 2024 07:00
@signedav signedav mentioned this pull request May 30, 2024
3 tasks
@signedav signedav changed the title T_Type values for GPKG Smart 1 Improvements (t_type consistency and optimization strategy) May 30, 2024
@signedav signedav marked this pull request as draft May 30, 2024 10:05
…not a table created (like for smart1)

only concern t_type option when it's relevant.
concerning the selected strategy has to be implemented.
Copy link
Collaborator

@gacarrillor gacarrillor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me.

The complexity here is a bit out-of-scope for me at the moment, I should really have a look at some MB documentation on polymorphic relations, optimization strategies, and the like. I'd appreciate if you can point me to some recommended resources (up-to-date docs, presentations, etc).

field_idx = (
fields.lookupField("T_basket")
if not_pg
else fields.lookupField("t_basket")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to have a variable holding the correct basket field name regardless of the engine (e.g., fields.lookupField(BASKET_FIELD_NAME)).

I'd have to refresh a bit how the Model Baker code has evolved to remember if this could be added as a class member. Just creating a note here in case you can think of something evident.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I will concern that.

# check filter in widget
ews = t_basket_field.editorWidgetSetup()
map = ews.config()
dataset_table = "T_ILI2DB_DATASET" if not_pg else "t_ili2db_dataset"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

if layer.layer.name() == "Strasse":
count += 1
value_map = layer.layer.editFormConfig().widgetConfig(
"T_Type" if not_pg else "t_type"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@signedav
Copy link
Member Author

The complexity here is a bit out-of-scope for me at the moment, I should really have a look at some MB documentation on polymorphic relations, optimization strategies, and the like. I'd appreciate if you can point me to some recommended resources (up-to-date docs, presentations, etc).

Yes, this first part was mainly about to provide the t_type. The second part - I will push in the next minutes - contains the functionality to have it optimized. An overview you can get with this from a user point of view: https://opengisch.github.io/QgisModelBaker/background_info/extended_models_optimization/#strategies and then what is done in the backend https://opengisch.github.io/QgisModelBaker/background_info/extended_models_optimization/ The documentation concerns Smart2 inheritance, while this PR is about Smart1. But maybe it makes sense anyway, to have a meeting for that.

@signedav signedav marked this pull request as ready for review May 31, 2024 13:18
@signedav signedav merged commit 65ba9c2 into main Jun 5, 2024
5 checks passed
@signedav signedav deleted the gpkg_t_type branch June 5, 2024 06:21
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.

Smart1 t_type value map with GPKG
2 participants