What is this and how many dad jokes about strawberries and planting can we all take?
Pretty sure you can all take a few more!
This is something i have been working on for a few days already and is coming into 1.0.0.RC1
We have now an XML file upload and processing Webform element which allows people (non devs) to upload a single XML file and get it processed and normalized into a given standard JSON structure so that the Strawberryfield can save it and hopefully do something cool with it. I even added a new branch, ISSUE-10c (pull to come when happy enough) inside Strawberryfield that does a quite smarter XML processing by making sure that independently of if there is a single subelement, or many, the way we/you/thing-that-this-pull-is-about access data is consistent. Consistent also means redundant, but cheap machinable v/s super smart(arbitrary data structure, not cheap to process)
Ok, don't get lost here: Imagine you imported an XML (EAD V3) and you got this now
"ap:importeddata": {
"content": {
"ead": {
"archdesc": [
{
"did": [
{
"abstract": [
{
"@value": "This collection contains the writings of Leonid Mikhailovich Savelov, an historian and genealogist. Included within this collection is a memoir penned by Savelov, and poetry written by his daughters."
}
],
"physdesc": [
{
"extent": [
{
"@value": "0.4 cubic feet (1 manuscript box)"
}
]
}
],
..
So how do i allow people to see the quite nested "abstract" element as a simple Textfield Webform element and edit it? I need something that reads from this complex structure and brings it up, to the surface.
That is what the Transplanter is!
Its a Computed/Processing Webform element, that takes can read from all the data that is passed and uses a Twig template that can transform data between structures, from a given source (in this case ap:importeddata": {
) and via simple code outputting a new JSON. This JSON of course matches (or not) keys/values of user interacting webform elements and updates the current submission allowing the 'Imported and now editing' magic to happen in a quite customizable manner. And it can have some cool logic, like 'Well, not an EAD? Do nothing, or even, clear the source values (remove the imported XML) if a certain mapping was done perfectly, or not override values set manually by the user/previous submission, or the opposite!
Of course right now it does just a few, the most core things of this, and of course as any strange code we write will need docs and use cases, but this will even allow CSVs to be uploaded, Data packages to be preprocessed and some crazy archiving goodness to happen.
@giancarlobi @alliomeria any questions about this? Too surreal?
@TODO
: I should make the processing as generic as possible so ingesting/mapping XML can happen via API too.