pepkit / pipestat

Pipeline results reporting package
https://pep.databio.org/pipestat/
BSD 2-Clause "Simplified" License
4 stars 2 forks source link

Extracting model creation code #188

Open nsheff opened 2 months ago

nsheff commented 2 months ago

I have another use case for which I'd like to create SQLModel/Pydantic models from JSON schema definitions.

We are doing that here in pipestat, but the code seems to be a little convoluted and integrated in with pipestat-specific things.

I'm wondering if we can extract this code into a modular function, so that I can do something like this:

# read json schema in from file into a dict
import json
my_dict = json.loads("path/to/schema.json")

# get model from this schema
MyModel = create_sqlmodel_from_dict(my_dict)

This is what I need and I feel like we already have built this functionality. What would it take to extract it so I can reuse it?