cemsbv / pygef

Parse soil measurement data.
https://cemsbv.github.io/pygef
MIT License
32 stars 18 forks source link

Allow import/export from JSON #136

Open tversteeg opened 3 years ago

tversteeg commented 3 years ago

The current format is not serializable, so it can't be non-trivially sent over a network connection. We need to add Cpt.from_json() and Cpt.to_json() methods (same for Borehole).

ritchie46 commented 3 years ago

Format of what? The gef files, or the state we keep internally when we parsed it?

tversteeg commented 3 years ago

Format of what? The gef files, or the state we keep internally when we parsed it?

The whole Cpt and Borehole classes. So basically the parsed state.

ritchie46 commented 3 years ago

Right, there is room for optimization here. I think we should consider a naive to_json, but also a serialize / deserialize. (with some options, e.g. `parquet, ipc, compression types).

For instance the columnar format of the DataFrame can be stored in binary and be compressed. Which can save quite some wire transfer.

breinbaas commented 2 years ago

Why not use pydantic's BaseModel which makes it easy with json() and parse_raw()

maarten-betman commented 1 year ago

Hi @tversteeg, this feature would be useful for some services I'm running. Ok if I put a PR in for this enhancement? How do you feel about usage of Pydantic?

tversteeg commented 1 year ago

Any PRs are greatly appreciated! Pydantic looks like a nice solution for this problem.