feat: adapt management events data schema standard and dynamic ui accordingly - #79
Open
pratikpakhale wants to merge 6 commits into
Open
pratikpakhale wants to merge 6 commits into
pratikpakhale wants to merge 6 commits into
Conversation
pratikpakhale
marked this pull request as draft
August 25, 2024 20:17
HenriKajasilta
self-requested a review
August 27, 2024 13:01
HenriKajasilta
force-pushed
the
parser
branch
from
December 10, 2025 13:15
a0e3ad0 to
cc786a9
Compare
…he deleted row's data
- upgrade legacy events on read: nest per-species vectors into harvest_list/planting_list, split grazing_period, map old notes names - drop -99.0 and other empty values when writing events - keep keys unknown to the schema when an event is edited - give each event field its own input id and validate it per event type - require event type, block and, where the schema says so, date - clear tables and dates of a previous event when filling or resetting - validate table rows by display position after a row is removed - show units and sentence-case labels from the schema - fix csv and json exports for the nested format - restore the icos_agri_user login - fail at startup if the schema cannot be loaded
Add soil_image and canopeo_image to the observation subtypes of the bundled schema as fileInput fields. The form renders them with mod_fileInput and passes the upload state to the main app, which saves, moves and deletes the files as before. The image field names now come from the schema instead of ui_structure.json, and the event list hides image columns. Also simplify the schema-driven form code: - skip const-only properties when the schema is loaded, dropping the const/NULL guards downstream - merge the widget render loops into render_field and replace the override_* params of render_property_widget - rename mod_table_server_schema to mod_table_server - restore na.strings when reading the sites file, so site "NA" is not read as missing - revert whitespace and comment churn unrelated to the schema work
pratikpakhale
marked this pull request as ready for review
September 29, 2026 13:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final Report: GSoC '24
Summary
The event form, the event list, the downloads and the saved
events.jsonnow all follow the management event JSON schema (inst/extdata/management-event.schema.json). Before this PR they were hand-written inui_structure.jsonanddisplay_names.csv. Adding or changing a field now means editing the schema.This finishes the GSoC '24 project Adopting Data Schema for Field Management Events. The original final report is in this description's edit history.
What changes
Event form
x-uicondition are shown only when the condition is met. Hidden fields are not validated or saved.x-uiform-type: fileInput).Saved events
Events are saved in the schema's shape: per-item values are nested in arrays, empty values are left out, and every event has a
$schemakey.Existing
events.jsonfiles are upgraded when they're read:organic_materialevent type becomes fertilizer with the organic subtypemgmt_event_long_notes/mgmt_event_short_notes-99.0missing values are droppedgrazing_periodis split intodate/end_dateA block's file is rewritten in the new format the next time an event in that block is saved.
Keys the schema doesn't know are kept unchanged, so no data is lost.
Event list and downloads
;.qvidjaanddev/dev_events.Cleanup
ui_structure.jsonnow only describes the app chrome: site and block, buttons, event list and help texts. The event form definitions and the code that built them are removed.attempt,ggplot2(only an@import, never called),methods,pkgload,processx.jsonvalidateto Suggests, for the test that validates saved events against the schema..RDatafile.Known issues
inst/extdata/has changed a lot since it was taken from hamk-uas/fieldobservatory-data-schemas, which hasn't changed since 2022. Saved events still set$schemato upstreammain, and they don't validate against it. The changes need to go upstream, and$schemashould be pinned to a tag or commit.soil_imageandcanopeo_image(x-uiform-type: fileInput) were added so photo upload keeps working. They need to be added upstream as well.display_names.csvhas no Swedish column, so with svenska selected the app chrome labels are blank and the event list crashes. It needs translations, or svenska should come out of the selector until they exist.Project Reflection
As I look back on my GSoC '24 project for PEcAn, I can see that the core components of my proposal were:
These two aspects ended up taking the majority of my time during the GSoC period. The parser development was particularly challenging, especially when it came to handling nested structures, 'oneOf' properties, and conditional rendering. I'm pleased that I was able to successfully implement the parser as a separate project, which can now generate UI elements based on the JSON schema.
However, within the allocated time for the project, I didn't have the opportunity to work on some of the additional features I had originally planned. These included:
Looking back, I still see these additional features as valuable for the project's overall goals. Implementing them would make the Fieldactivity app more flexible and easier to maintain, as it would allow for dynamic form generation based on a standardized schema. This would improve compatibility with other data sources and make it easier to update the data structure in the future.
While I didn't have time to implement these extra features during the GSoC period, I believe the work I've done on the parser lays a solid foundation. This can serve as a starting point for future development, either by myself (I plan to do so) or other contributors to the PEcAn project.
In reflection, I feel that my project achieved its primary goal of creating a functional parser for the JSON schema, which is a significant step towards improving the Fieldactivity app's flexibility and maintainability. The integration and additional features remain important for the project's future development, and I believe they could be valuable contributions for the PEcAn community going forward.
Overall Experience
One of my favorite aspects of participating in Google Summer of Code (GSoC) has been the incredible exposure to real-world software development projects, especially in R. It's been a fantastic way to apply what I've learned in a practical setting and see the impact of my work.
Mentorship and Community Interaction: I absolutely value the opportunity to connect with mentors, the community and my fellow peers in PEcAn family. The guidance and support from my mentors have really helped a lot. I've learned so much about open-source culture, how to communicate and have developed valuable relationships that I believe will continue to benefit me in the future.
Flexibility and Independence: The program's flexibility is another highlight for me. Being able to work independently from anywhere has been empowering. My mentors understanding my commitments and requests was also one of the things I appreciate the most!