Skip to content

Commit

Permalink
add metadata to analysis (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkent authored May 4, 2024
1 parent 8f4b935 commit c394985
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions store/neurostore/models/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class Analysis(BaseMixin, db.Model):
)
name = db.Column(db.String)
description = db.Column(db.String)
metadata_ = db.Column(JSONB)
order = db.Column(db.Integer)
# used to keep track of neurosynth analyses (in case of neurosynth/ace updates)
table_id = db.Column(db.String)
Expand Down
2 changes: 1 addition & 1 deletion store/neurostore/openapi
3 changes: 3 additions & 0 deletions store/neurostore/schemas/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class StudysetStudySchema(BaseDataSchema):
class AnalysisSchema(BaseDataSchema):
# serialization
study_id = fields.String(data_key="study", metadata={"id_field": True})
metadata = fields.Dict(attribute="metadata_", dump_only=True)
metadata_ = fields.Dict(data_key="metadata", load_only=True, allow_none=True)
# study = fields.Pluck("StudySchema", "id", metadata={"id_field": True})
conditions = StringOrNested(ConditionSchema, many=True, dump_only=True)
order = fields.Integer()
Expand Down Expand Up @@ -560,6 +562,7 @@ def dump(self, a):
"id": a.id,
"user": a.user_id,
"name": a.name,
"metadata": a.metadata_,
"description": a.description,
"conditions": [ac_schema.dump(ac) for ac in a.analysis_conditions],
"weights": list(a.weights),
Expand Down

0 comments on commit c394985

Please sign in to comment.