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

Paginate schema results #64

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

Ghesselink
Copy link
Contributor

@Ghesselink Ghesselink commented Mar 2, 2023

Flask endpoint to paginate schema results.

The json can be invoked in the frontend as follows (the mentioned code should then be in Jinja on the frontend) :

  • Get constraint types:
(Pdb) results['constraint_types'] # access jsonified dictionary 'results'
['schema', 'global_rule', 'entity_rule'] 

Based on these constraint_types, it should be possible to make columns/headers, similar as in the work for schema headers (johltn#10). Note that the returned constraint_types are only constraints of which values are found, not all the inputs for the columns in the database.

constraint_type = Column(Enum("uncategorized", 'schema', 'global_rule', 'simpletype_rule', 'entity_rule', name='schema_constraint_types'), default="uncategorized")

Each subcategory is then sliced and can be modified by calling the Flask API with start and end as parameters, similar as in https://github.com/johltn/ifc-pipeline-validation/blob/ui/application/main.py#L474 . The sorting is done by the work of Thomas in the database, which is also added to the current PR.

class schema_validation_task(validation_task):
results = relationship("schema_result", order_by='schema_result.constraint_type.asc(),schema_result.attribute.asc()')

Furthermore, it is possible to access all the (slice) by using the constraint types found by the earlier statement.
For example (code will then be in Jinja on the front end):

constraint types = results['constraint_types']
>> for constraint_type in constraint_types: #schema, global_rule, entity_rule
>>          results['values'][constraint_type]['saved_values] # returns all serialized schema_results with constraint type 'schema' (in first    iteration)
>>        result['values'][constraint_type][count] # returns count, similar as in earlier mentioned PR of Johan

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.

1 participant