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

Use pydantic to generate json, instead of putting string attributes in entities #7679

Open
3 tasks
wkoot opened this issue Dec 15, 2023 · 0 comments
Open
3 tasks
Labels
python Pull requests that update Python code Tech Technical change without significant user impact
Projects

Comments

@wkoot
Copy link
Contributor

wkoot commented Dec 15, 2023

User story

As a developer I want to use native types as much as possible, so that I don't need to do unnecessary string munging.
This includes comparing parse_datetime(entity.created_date) with something like "lookback period" or "days ago", but also the strings of SourceMeasurement total and value.
Pydantic should handle conversion to json, with stringy values if needed. Note that we currently already do some comprehension; i.e. when there's a datetime string returned in an entity, but EntryAttribute type is DATE.
To discuss: convert to string in collector (which means the db doesn't change), or in api (so native types can be used in all python code)?

Tasks

Components

Shared code

  • Review the data model for entities

API-server

  • TBD - should the json be generated here, or by the collector (before storing in db)?

Collector

  • Change collector so that all entity attributes are native in code instead of casting to string
@wkoot wkoot added Tech Technical change without significant user impact python Pull requests that update Python code labels Dec 15, 2023
@wkoot wkoot added this to Backlog in Backlog via automation Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code Tech Technical change without significant user impact
Projects
Backlog
Inbox
Development

No branches or pull requests

1 participant