Skip to content

updated models to support background images #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

bendhouseart
Copy link

This was mainly added so that a background image could be applied to a protocol/input for the recently added cavas attribute at ReproNim/reproschema-ui#363

Potentially allows for background use in other activities b/c it was easier to minimally implement and/or one could add a background image/logo or something for their own protocol.

Helps resolve failing CI at ReproNim/demo-protocol#33

This was mainly added so that a background image could be applied
to a protocol/input for the recently added cavas attribute at
ReproNim/reproschema-ui#363

Potentially allows for background use in other activities b/c
it was easier to minimally implement and/or one could add
a background image/logo or something for their own protocol.
@bendhouseart
Copy link
Author

@yibeichan @djarecka could someone take a look at this? Also, I think I'll need to git tag it with a new version to trigger a build on pypi correct?

Copy link
Collaborator

@ericearl ericearl left a comment

Choose a reason for hiding this comment

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

This PR looks very clean to me. Do you need to also update some docs to point out backgroundImage as a newly existent thing or will it auto-generate in sphinx reference docs or some such thing? Also, I can't guarantee myself this is satisfactory to the reproschema coding styling, but if it passes CI I suspect it's good. Aside from all that, given the fact you've tested this and it works, I believe you've got a great PR here.

@bendhouseart
Copy link
Author

@ericearl I think that once this piece is in place along with the other PR's we'll be updating the docs at repronim/reproschema. The only thing I'm uncertain about is whether to call it canvas or something else. Maybe it's clear enough that this is used to capture drawing inputs, but (for sure) we're going to want to update the documentation. I'm thinking that those updates might be a great exercise (not just for this new field) for you, me, and Paul here at the NIMH. Especially since we're all fresh to this project.

@yibeichan
Copy link
Contributor

@djarecka this one looks good to me do you have anything specific regarding the model that we need to pay extra attention to or we can merge this one?

@djarecka
Copy link
Member

hi, sorry for the delays, but this is not the repository to change the model. The reproschema model is here: https://github.com/ReproNim/reproschema

I don't see the changes there, am I missing something @yibeichan ?

@yibeichan
Copy link
Contributor

@djarecka this is for the validate function. we try to make validate accept background image. do you think we need to make updates in model itself?

@djarecka
Copy link
Member

djarecka commented Jul 15, 2025

you are modifying the model, by adding backgroundImage. The model.py is generated automaticaly in reproschema repository based on the changes to the linkml model, so it should not be modified manually here.

I can help with the linkml model and creating a new release if this new property is needed. We can also come back to the discussion, if indeed the model changes is needed and we should have both image and backgroundImage, that I started here

@satra - there is no really good description of image in the model, do you have any thoughts if this can be used as a background image?

@djarecka
Copy link
Member

@bendhouseart - I've read some of the conversations on various repos again. In some you mentioned adding just a static image/logo, and this I believe you can easily use the existing image that you can currently use in Item, Activity and Choice. If UI doesn't show for some reason, we should simply fix UI.

In other places, you mentioned drawing on the background, and this is the case that I would try to understand more. Do some of your Item require drawing? If yes, perhaps we should introduce another inputType for Item, and I think you already started changing it in UI, and introduced canvas. If you believe that for this kind of questions one might need two types of images, e.g., general logo, and background for drawing, then we should add additional property, but perhaps I would name it differently, e.g., "drawingBacground", or something similar.

@ericearl
Copy link
Collaborator

@djarecka This was a discovered need for the Montreal Cognitive Assessment (MoCA), specifically. The assessment question is called "Alternating Trail Making" and you can read about it here:

https://www.smchealth.org/sites/main/files/file-attachments/moca-instructions-english_2010.pdf

There's also some pictures here:

https://geriatrictoolkit.missouri.edu/cog/MoCA-8.3-English-Test-2018-04.pdf

Do some of your Item require drawing?

Yes.

... perhaps we should introduce another inputType for Item, and I think you already started changing it in UI, and introduced canvas. If you believe that for this kind of questions one might need two types of images, e.g., general logo, and background for drawing, then we should add additional property, but perhaps I would name it differently, e.g., "drawingBacground", or something similar.

I suspect @bendhouseart is fine with any name in the code/schema, but would just like this ability to exist in the model or schema.

@djarecka
Copy link
Member

@ericearl - sounds good, let's add another option for item, and add additional property to the model, but this really should be done in the reproschema repository: https://github.com/ReproNim/reproschema.
If you want I can start the changes there.

@djarecka
Copy link
Member

@bendhouseart , @ericearl - I've added a quick note on the model to the Readme to avoid confusion next time, really sorry for it.

@bendhouseart
Copy link
Author

bendhouseart commented Jul 17, 2025

I suspect @bendhouseart is fine with any name in the code/schema, but would just like this ability to exist in the model or schema.

Yes!

Lately I've been more focused on getting a dev environment working to better test out changes given that I'm only able to serve and test them by a series of ad-hoc scripts I've got, so thank you all for pushing this back up the priority list. This is the only feature lacking from reproschema for our lab; having it would enable us to transition entirely away from good ole paper.

@bendhouseart - I've read some of the conversations on various repos again. In some you mentioned adding just a static image/logo, and this I believe you can easily use the existing image that you can currently use in Item, Activity and Choice. If UI doesn't show for some reason, we should simply fix UI.

In other places, you mentioned drawing on the background, and this is the case that I would try to understand more. Do some of your Item require drawing? If yes, perhaps we should introduce another inputType for Item, and I think you already started changing it in UI, and introduced canvas. If you believe that for this kind of questions one might need two types of images, e.g., general logo, and background for drawing, then we should add additional property, but perhaps I would name it differently, e.g., "drawingBacground", or something similar.

I would say not so easily as it's been challenging just getting a dev environment working ;) From my perspective the path of least resistance would be to get the canvas feature live and working at -> https://www.repronim.org/reproschema-ui/#/ via this update and the successful merging of the added canvas input to the demo protocol.

Concerning the property/selection of backgroundImage, I know that by adding it we're leaning into Vue and Vue's built in CSS so that's what I went with. I would make the argument that it's best to make reproschema more closely conform to CSS and the web based naming scheme in this instance. Additionally, I think backgroundImage is useful outside of this context as it can be used for watermarks/logos/etc in addition to capturing drawing inputs.

All that said I'll admit one can make just as convincing of an argument about the existing image property, supposing it can be made to work.

@djarecka
Copy link
Member

djarecka commented Jul 19, 2025

@bendhouseart - I've started PR in the model repo: ReproNim/reproschema#543
Note, that I didn't add it to UI, but directly to Item

This is the pydantic version generated from new yaml, so you can check: https://github.com/djarecka/reproschema-py/blob/tmp_new_model/reproschema/models/model.py

There is new formatting in newer linkml, so you will see more changes. Let me know if this will work.

@djarecka
Copy link
Member

Also, right now, we don't check inputType, but there is an open PR, that it would be nice to merge if we are doing new release. Check the InputType that we have, and let's suggest something that would fit well and be informative.

@yibeichan
Copy link
Contributor

we can close this one since we should fix everything in ReproNim/reproschema#543

@yibeichan yibeichan closed this Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants