Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

refactor: xna2bids schema#104

Open
mirestrepo wants to merge 10 commits into
mainfrom
refactor-xna2bids-schema
Open

refactor: xna2bids schema#104
mirestrepo wants to merge 10 commits into
mainfrom
refactor-xna2bids-schema

Conversation

@mirestrepo

@mirestrepo mirestrepo commented Feb 25, 2022

Copy link
Copy Markdown
Contributor

This PR moves the Xnat2BidsForm to use the json schema. There are a couple of more complex sections that were tricky to get right with the basic form components via JSON so I packaged them as higher level components namely Xnat2BidsSessions and Xnat2BidsBidsmap.

I'm unsure yet what is the right balance between wrapping things into higher level components to keep the UI schema easier to make/read or to keep using low-level components only. For now, I try for a while and if it's too cumbersome I give up ;).

If one day I manage to make some of these inputs automatically update from other python packages, I'll need to revisit these higher level components as some of the "configurations" get embedded in them and are not exposed to the schema at the moment. But baby steps!

Also, I left the schema fairly simple. I'm planning to revisit it later when I try to figure out how to use the schema for validation more efficiently, because at the moment adding any more info to the schema (not the UI schema) doesn't really change anything as it is not getting used.

@github-actions

github-actions Bot commented Feb 25, 2022

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 4ddc60a):

https://bnc-script-generator--pr104-refactor-xna2bids-sc-ycemc70j.web.app

(expires Fri, 04 Mar 2022 21:08:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@eldu eldu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good and more deletions! I added in a question and bat signaled mary 😆

},
fieldType: {
type: String,
required: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think required: false is the default but it's alright that you include this!

removeSession: 'xnat2bids/popSession',
}),
updateValue(index, key, val) {
this.value[index][key] = val

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're updating the prop directly here from the child. Are you experiencing any issue here? I would have thought that you needed to emit the value and then set the prop in the parent component.

Maybe @mcmcgrath13 ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, directly updating a prop can cause an infinite render loop. Generally emitting and updating the parent is the safer bet.

Comment on lines +66 to +70
fieldProps() {
const optProps = {}
this.fieldType && (optProps.type = this.fieldType)
this.fieldMessage && (optProps.message = this.fieldMessage)
return optProps

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it might be more straightforward to not have a default on these props and then just make fieldProps the values passed (which would be undefined if not set)? Or does the presence of those keys mess with something even if undefined?

Comment on lines +38 to +41
updateValue(key, val) {
this.value[key] = val
this.$emit('f-bidsmap', this.value)
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combination of v-model and overwriting the @input event and then changing, but also emitting isn't a combination I've seen much (it kind of murkies a one-way data binding and a two-way). Are the v-models really needed? Could those maybe be just values? Or is there maybe an example/documentation that outlines this pattern that could be linked to in a comment?

for (let i = 1; i < this.sessions.length; i++) {
key = this.sessions[i].participant_id
sval = this.sessions[i].s_series.join(' -s ')
for (let i = 1; i < this.xnat2bids.sessions.length; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be changed to for (const session of this.xnat2bids.sessions) and then could drop all the indexing (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants