dieterich-lab / scimodom

Sci- ModoM: A quantitative database of transcriptome-wide high-throughput RNA modification sites
https://dieterich-lab.github.io/scimodom/
GNU Affero General Public License v3.0
0 stars 0 forks source link

Data serialization #42

Closed eboileau closed 10 months ago

eboileau commented 10 months ago

Aims/objectives.

As of version 1.1.0 Flask, if a view returns a dict it will be turned into a JSON response, i.e. no need to jsonify. To return a JSON response and set a status code, we can use make_response.

For database models, do we need a serialization library? There are many options here, I'm not sure which one is best suited to our application. Now it's not even a proper flat implementation, but barely a "conversion" from tuples list to dict using predefined keys and ordering. maybe a simple extension to SQLAlchemy's declarative base, etc. is enough?

Also do we have to deal with response status codes, headers, etc?

A clear and concise description of todo items.

eboileau commented 10 months ago

Since we're generally selecting individual attributes for performance and clarity, the simplest solution is to call _asdict() on the Row objects, and use .label where necessary. If this isn't enough, this can be refactored at a later stage.