EML icon indicating copy to clipboard operation
EML copied to clipboard

Possible Inclusion of a Shiny Attribute Table Builder

Open maier-m opened this issue 6 years ago • 10 comments

Hello, I built some tools for the Arctic Data Center at NCEAS to help build attribute tables in an R shiny environment. A demonstration of the tools is shown below. Essentially the tools use R shiny and handsontableJS to create an opinionated tabular environment for building attributes. Enumerated domain factors and custom units are also built simultaneously. Additionally there are tools built using the udunits2 library to help users with converting to EML units (e.g. inputting "m" will automatically correct to "meter"). I built these for the NCEAS ADC data support team but feel they may have utility to EML users at large. Please let me know if there is any interest including versions of these tools here.

create_attributes_table

maier-m avatar Apr 20 '18 00:04 maier-m

@maier-m This looks really cool! Have you taken a look at https://github.com/cboettig/eml2 ? eml2 uses a JSON structure on the backend to represent EML (which can be rendered into schema-valid XML), which I think make it much easier to build upon than original EML. (e.g. you can get a light-weight version of this just by using the json editor from the listviewer package), and might be easier to work with from handsontable as well? (Since my development effort is now more on eml2 I'm also just trying to get more eyes on it and would love if you could take a look; I think it addresses some of the more frustrating aspects of working with the EML package, like getting rid of all the @[[1]] and as(... nonsense.)

But really like the interface and the integration with udunits2 to build and export the attributes table, and I think other users would find that valuable. I'd certainly welcome a PR here and/or at eml2.

cboettig avatar Apr 20 '18 05:04 cboettig

Great. Yeah, these tools don't actually build any EML class objects. They just build data.frames which readily can be transformed into EML objects with existing EML, and from what it appears, eml2 tools. I will take a deeper look at eml2 and create a PR. Thanks.

maier-m avatar Apr 20 '18 16:04 maier-m

Right, so it creates the attribute table in .csv format independent of any subsequent tooling that turns that table into an EML structure. That makes perfect sense. Incidentally, have you found the table format sufficient for the data the Arctic team encounters? Obviously it's not quite as flexible as the attribute definitions of native EML, but I hope it hits the most use cases. Looks like you are also highlighting which fields are required?

cboettig avatar Apr 20 '18 17:04 cboettig

  • Correct (returns either csv format or just returns an R data.frame if you don't want/need to save externally).

  • Yes, table formats are very helpful as everyone is comfortable working in such an environment (but it can get confusing on complex EML structures such as attributes if not so familiar with the eml schema, this is the purpose of these tools).

  • Yes, the shiny app is opinionated and highlights which fields are required and also greys out fields not required (i.e. units are greyed out if measurementScale is dateTime but formatString then becomes highlighted.) The idea is to try to mimic the native EML structure as best as possible in a familiar tabular format (which you could also copy and paste from).

maier-m avatar Apr 20 '18 18:04 maier-m

This was merged into https://github.com/cboettig/eml2/pull/10 , which has now been merged back here.

@maier-m it would be wonderful if you might update / replace the current working-with-units vignette to reflect these tools (both the cli and shiny interface)? Or did we have that vignette and I misplace it in all the merging and moving?

cboettig avatar Nov 27 '18 19:11 cboettig

Hi Carl,

I agree. Let me take a look and I can see if I can update these. It might take me a couple days to get around to it, but will make a note. I don't think a clear vignette was ever made.

Cheers,

  • Mitchell

On Tue, Nov 27, 2018 at 11:56 AM Carl Boettiger [email protected] wrote:

This was merged into cboettig/eml2#10 https://github.com/cboettig/eml2/pull/10 , which has now been merged back here.

@maier-m https://github.com/maier-m it would be wonderful if you might update / replace the current working-with-units vignette to reflect these tools (both the cli and shiny interface)? Or did we have that vignette and I misplace it in all the merging and moving?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/EML/issues/243#issuecomment-442195168, or mute the thread https://github.com/notifications/unsubscribe-auth/AP78jLR7IAP2Gm9KX_RpNDvjDmn0_eloks5uzZjqgaJpZM4TcrPw .

maier-m avatar Nov 27 '18 21:11 maier-m

@maier-m Thanks Mitchell! A vignette, maybe with a screenshot of the shiny app, would be awesome.

Also, I had some trouble on the get_unit_id tests recently that really confused me, two tests seemed to expect additional behavior simplifying the unit notation. I couldn't reproduce the expected behavior so those tests are currently turned off: https://github.com/ropensci/EML/blob/master/tests/testthat/test_get_unit_id.R#L80-L106

maybe you can take a quick look at that as well? Thanks much.

cboettig avatar Nov 27 '18 21:11 cboettig

Ok, good to know. There may be something funny happening there, I can take a look as well.

  • Mitchell

On Tue, Nov 27, 2018 at 1:10 PM Carl Boettiger [email protected] wrote:

@maier-m https://github.com/maier-m Thanks Mitchell! A vignette, maybe with a screenshot of the shiny app, would be awesome.

Also, I had some trouble on the get_unit_id tests recently that really confused me, two tests seemed to expect additional behavior simplifying the unit notation. I couldn't reproduce the expected behavior so those tests are currently turned off: https://github.com/ropensci/EML/blob/master/tests/testthat/test_get_unit_id.R#L80-L106

maybe you can take a quick look at that as well? Thanks much.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/EML/issues/243#issuecomment-442218010, or mute the thread https://github.com/notifications/unsubscribe-auth/AP78jKO2vDDXqy_VjEL8MkFIMJ7mjiSNks5uzao7gaJpZM4TcrPw .

maier-m avatar Nov 27 '18 22:11 maier-m

It's not clear how to use the EML::shiny_attributes() to build the tables, as demonstrated by OP.

When I open EML::shiny_attributes(), I am left with a screen that allows only the following options:

  • quit app (which works as expected)
  • help (does nothing)
  • tab:attributes table (nothing to edit, just a download button)
  • tab:factor table (nothing to edit, just a download button)
  • tab:units table (nothing to edit, just a download button)

Here is a screenshot of what I see when I run EML::shiny_attributes() image

This screenshot shows the app being "greyed" out, which reflects what I am seeing when running the app. Not sure what's going on there, either.

trashbirdecology avatar Jun 11 '20 16:06 trashbirdecology

Hi @TrashBirdEcology do you mind sharing your session info? when I run t <- shiny_attributes() I see this: Screen Shot 2020-06-11 at 9 47 47 AM

Note that you can also run shiny_attributes assigning the data argument to a data.frame with your data, which will pre-fill some information.

jeanetteclark avatar Jun 11 '20 16:06 jeanetteclark