flare-floss icon indicating copy to clipboard operation
flare-floss copied to clipboard

QS: Output Schema

Open ooprathamm opened this issue 11 months ago • 3 comments

Closes #721

ooprathamm avatar Mar 14 '24 18:03 ooprathamm

  • 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)

ooprathamm avatar Mar 14 '24 18:03 ooprathamm

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.

mr-tz avatar Mar 16 '24 08:03 mr-tz

Thanks, will review this in the upcoming days.

mr-tz avatar Mar 19 '24 20:03 mr-tz