flare-floss
flare-floss copied to clipboard
QS: Output Schema
Closes #721
- ResultDocument could act as output scheme, that is used by render_strings() or to dump json
- For Merging the database keys (Idea for discussion):
-
Migrate Databases from struct to pydantic model
-
Sequence of Database objects in TaggedStrings populated by taggers
-
Database = Union[ StringGlobalPrevalenceDatabase, OpenSourceStringDatabase....]
class TaggedString:
metadb: Sequence[Database]
Make query_fn used by tagger return tag and instance
def query_fn(db: Database, string: str) -> Tuple[Sequence[str], Sequence[Database]]:
if db.query(string):
return ("#tag",), [db.query]
return (), []
In tag_strings update tag and instance
for tagger in taggers:
tags, db = tagger(string.string)
tags.update(tags)
db_keys.extend(db)
ResultDocument could act as output scheme, that is used by render_strings() or to dump json
That should be the goal; to have one data source used by various output modes.
Migrate Databases from struct to pydantic model
Any formalization like that would be great.
Thanks, will review this in the upcoming days.