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

tibble to mindmap? #7

Closed
overvolting opened this Issue Feb 6, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@overvolting

overvolting commented Feb 6, 2018

What about other data sources?
Typically workflow goes

  1. Read data
  2. Make tibble
  3. outputs (mindmaps)

How can we make mindmaps based on tibbles?

@pzhaonet

This comment has been minimized.

Owner

pzhaonet commented Feb 14, 2018

Could you give a mini example to specify your request?

@overvolting

This comment has been minimized.

overvolting commented Feb 14, 2018

Absolutely, thanks for the reply.

I have a database that can export it's structure in a format similar to this (I've anonymized the data and copied down the paths so they repeat where needed):

> dput(et1)
structure(list(Folder = structure(c("/Root name", "/Path A", 
"/Path A/Product A", "/Path A/Product A/Process A", "/Path A/Product A/Process A/Step A/Record 1", 
"/Path A/Product A/Process A/Step A/Record 1/Analyses", "/Path A/Product A/Process A/Step A/Record 1/Analyses", 
"/Path A/Product A/Process A/Step A/Record 1/Analyses", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts", 
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts", 
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts", 
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path B", 
"/Path C"), .Dim = c(16L, 1L), .Dimnames = list(c("2", "3", "4", 
"5", "6", "7", "7", "7", "10", "10", "10", "10", "10", "10", 
"16", "17"), "Folder")), Object.Name = c(NA, NA, NA, NA, "Object 1", 
"Object 2", "Object 3", "Object 4", "Part1", "Part2", "Part3", 
"Part4", "Part5", "Part6", NA, NA), Object.Type = c(NA, NA, NA, 
NA, "User form", "Data source type 1", "Data source type 2", 
"Data source type 2", "Number", "Number", "Number", "Number", 
"Text", "Text", NA, NA), Current.Revision = c(NA, NA, NA, NA, 
1L, 3L, 1L, 1L, NA, NA, NA, NA, NA, NA, NA, NA), Latest.Approved.Revision = c(NA, 
NA, NA, NA, NA, NA, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("Folder", 
"Object.Name", "Object.Type", "Current.Revision", "Latest.Approved.Revision"
), row.names = 2:17, class = "data.frame")

In the real export there are maybe a thousand or more objects and paths. The '/Root Name' is the name of the root folder, so it would be the starting or central node.

I would like to turn this path and object information into a mindmap. To start, just capturing the paths and the objects would be great, so the mindmap can give you a visual sense of what's in the database. If the .mm format supports it, maybe the object type could be indicated by a specific icon or color and the version captured in some callout text.

@overvolting

This comment has been minimized.

overvolting commented Feb 14, 2018

Here's an example rendered mindmap that could be created from such a table:
https://imgur.com/a/mgoVS

and the source (created manually and exported via xmind application):
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1"><node CREATED="1518624605953" ID="6aafl8il16sgol0a2f98h7fj1e" MODIFIED="1518624605953" TEXT="Root name"><node CREATED="1518624605953" ID="4gg26n2u55lqjr4le2hvt2muhc" MODIFIED="1518624605953" POSITION="right" TEXT="Path A"><node CREATED="1518624605953" ID="6ap2jacrbgg63me9gl51dhtc7l" MODIFIED="1518624605953" TEXT="Product A"><node CREATED="1518624605953" ID="3vr7rc3usjtjj2ilvmferd5ei7" MODIFIED="1518624605953" TEXT="Process A"><node CREATED="1518624605953" ID="60tqkqbh9pob0mhdl03ms4g7aa" MODIFIED="1518624605953" TEXT="Step A"><node CREATED="1518624605953" ID="0diak1fokgmlqkq8v9u01igl5v" MODIFIED="1518624605953" TEXT="Record 1"><node CREATED="1518624605953" ID="7mbb5ipapbkuqvnu3umog88kga" MODIFIED="1518624605953" TEXT="Analyses"><node CREATED="1518624605953" ID="05irrv7ln6v2q1eqlh7qq6msni" MODIFIED="1518624605953" TEXT="Object 2"><node CREATED="1518624605953" ID="19h266h8oholj49phevmo99an4" MODIFIED="1518624605953" TEXT="Type: data source"/><node CREATED="1518624605953" ID="1p8l3gr8igs0npbcj1pfs51djs" MODIFIED="1518624605953" TEXT="Version: 3"/></node><node CREATED="1518624605954" ID="6ruki21gtda0n8l41g3jpbd0lk" MODIFIED="1518624605954" TEXT="Object 3"><node CREATED="1518624605954" ID="04m383jp3mf0g94j5loqiqllr3" MODIFIED="1518624605954" TEXT="Type: data source"/><node CREATED="1518624605954" ID="3iue41oq3623hnbhjpvu1mbvd8" MODIFIED="1518624605954" TEXT="Version: 1"/></node><node CREATED="1518624605954" ID="4omal9q5dgqbjoadb9v58siflc" MODIFIED="1518624605954" TEXT="Object 4"><node CREATED="1518624605954" ID="4hjnm9pmnlethbti67ooohm81d" MODIFIED="1518624605954" TEXT="Type: data source"/><node CREATED="1518624605954" ID="4ddkogqg5dsagar9jpuorrspdk" MODIFIED="1518624605954" TEXT="Version: 1"/><node CREATED="1518624605954" ID="75dj99bii17r56b03l7saubsmg" MODIFIED="1518624605954" TEXT="Approved Version: 1"/></node></node><node CREATED="1518624605954" ID="40ncqfp1esa0bcb5c6htv3k57t" MODIFIED="1518624605954" TEXT="Setup Parts"><node CREATED="1518624605954" ID="6qrqjjjslkeot1f9gl1m99lpcm" MODIFIED="1518624605954" TEXT="Part1"><node CREATED="1518624605954" ID="2nd5dq6srmfogkk90l32drs62n" MODIFIED="1518624605954" TEXT="Type: Number"/></node><node CREATED="1518624605954" ID="0r1h3breufqn9ht77pju3sbe5i" MODIFIED="1518624605954" TEXT="Part2"><node CREATED="1518624605954" ID="3164glh05ucho4n50vhcblegkh" MODIFIED="1518624605954" TEXT="Type: Number"/></node><node CREATED="1518624605954" ID="242j996kcq50nl9fopvfk7icgf" MODIFIED="1518624605954" TEXT="Part3"><node CREATED="1518624605954" ID="2tmud8mk1kac0e8vnreadlio7b" MODIFIED="1518624605954" TEXT="Type: Number"/></node><node CREATED="1518624605954" ID="47hi23u1phcoe4thhcg342da34" MODIFIED="1518624605954" TEXT="Part4"><node CREATED="1518624605954" ID="0508pv5vq3ppa2macp2svajhfm" MODIFIED="1518624605954" TEXT="Type: Number"/></node><node CREATED="1518624605954" ID="1gmucpeb30jc3k6h4647q29b47" MODIFIED="1518624605954" TEXT="Part5"><node CREATED="1518624605954" ID="7sq7jojear5m1tapc0ufca3eub" MODIFIED="1518624605954" TEXT="Type: Text"/></node><node CREATED="1518624605954" ID="63ipd4qmp25ahctqgepdlsv1tu" MODIFIED="1518624605954" TEXT="Part6"><node CREATED="1518624605954" ID="746dna8cqfpomceg6jgncfhudh" MODIFIED="1518624605954" TEXT="Type: Text"/></node></node><node CREATED="1518624605954" ID="30hs0ic41ga9pf58uosg72ummt" MODIFIED="1518624605954" TEXT="Object 1"><node CREATED="1518624605954" ID="4uu2s90iha469jflihar7betcs" MODIFIED="1518624605954" TEXT="Type: User form"/><node CREATED="1518624605954" ID="70qasbhrh5n3a884mhf1hg5518" MODIFIED="1518624605954" TEXT="Version: 1"/><node CREATED="1518624605954" ID="3cisp199c7d31tr0c8up2gm7ju" MODIFIED="1518624605954" TEXT="Approved Version: 1"/></node></node></node></node></node></node><node CREATED="1518624605954" ID="3f7buu6vjkva0lvi2b969iridk" MODIFIED="1518624605954" POSITION="right" TEXT="Path B"/><node CREATED="1518624605954" ID="3oa0d2r83rrhef7tfqaivo77ir" MODIFIED="1518624605954" POSITION="left" TEXT="Path C"/></node></map>

@pzhaonet

This comment has been minimized.

Owner

pzhaonet commented Feb 15, 2018

I guess I've got your point, although I cannot reproduce your example. If you give me a script that I could reproduce the database et1, I might be able to achieve it.

The mindr package was intended to produce mindmaps from markdown. If you can convert your database into a markdown text file, then mindr can do the rest job.

@overvolting

This comment has been minimized.

overvolting commented Feb 15, 2018

Hello,

For my example, converting to a markdown file is one option, though I'm not sure how to do it. Another option might be to use xml2 library to go directly from dataframe > xml .mm format.

mindr is the only R package I have found that works with mindmap files, so you could consider somehow handling dataframes and tibbles as input for producing the mindmaps since they're more commonly used than markdown.

In fact, adapted to the normal R workflow you could have the option to go both ways:
mindmap <> dataframe. You could also go markdown <> dataframe. There are other network visualization libraries in R, they typically use dataframes as configuration so one possible bridge could be mindmap <> dataframe <> viznetwork for example.

If you would like to recreate et1 you can run this command in R:

et1 <- structure(list(Folder = structure(c("/Root name", "/Path A",
"/Path A/Product A", "/Path A/Product A/Process A", "/Path A/Product A/Process A/Step A/Record 1",
"/Path A/Product A/Process A/Step A/Record 1/Analyses", "/Path A/Product A/Process A/Step A/Record 1/Analyses",
"/Path A/Product A/Process A/Step A/Record 1/Analyses", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts",
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts",
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path A/Product A/Process A/Step A/Record 1/Setup Parts",
"/Path A/Product A/Process A/Step A/Record 1/Setup Parts", "/Path B",
"/Path C"), .Dim = c(16L, 1L), .Dimnames = list(c("2", "3", "4",
"5", "6", "7", "7", "7", "10", "10", "10", "10", "10", "10",
"16", "17"), "Folder")), Object.Name = c(NA, NA, NA, NA, "Object 1",
"Object 2", "Object 3", "Object 4", "Part1", "Part2", "Part3",
"Part4", "Part5", "Part6", NA, NA), Object.Type = c(NA, NA, NA,
NA, "User form", "Data source type 1", "Data source type 2",
"Data source type 2", "Number", "Number", "Number", "Number",
"Text", "Text", NA, NA), Current.Revision = c(NA, NA, NA, NA,
1L, 3L, 1L, 1L, NA, NA, NA, NA, NA, NA, NA, NA), Latest.Approved.Revision = c(NA,
NA, NA, NA, NA, NA, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("Folder",
"Object.Name", "Object.Type", "Current.Revision", "Latest.Approved.Revision"
), row.names = 2:17, class = "data.frame")

@pzhaonet

This comment has been minimized.

Owner

pzhaonet commented Feb 19, 2018

Thanks for the hint. After several days' work I have written a new function in mindr, which is close to your request. Please reinstall the dev version of mindr and have a try:

devtools::install_github("pzhaonet/mindr")
library(mindr)
et2 <- c("/Root name", "/Path A", "/Path A/Product A", "/Path A/Product A/Process A", 
    "/Path A/Product A/Process A/Step A", "/Path A/Product A/Process A/Step A/Record 1", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses/Object 1", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses/Object 1/Type: data source", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses/Object 1/Version: 3", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses/Object 2", 
    "/Path A/Product A/Process A/Step A/Record 1/Analyses/Object 3", 
    "/Path A/Product A/Process A/Step A/Record 1/Setup Parts", 
    "/Path A/Product A/Process A/Step A/Record 1/Setup Parts/Par 1", 
    "/Path A/Product A/Process A/Step A/Record 1/Setup Parts/Par 2", 
    "/Path A/Product A/Process A/Step A/Record 1/Setup Parts/Par 3", 
    "/Path B", "/Path C")
tree2mm(et2)

It generates a mind map like this:

root name

You can find that the demo data et2 is different from your demo et1, because I do not know much about the structure of tibble dataframe. If you can convert your dataframe into a vector like et2, then your problem can be solved.

@overvolting

This comment has been minimized.

overvolting commented Feb 26, 2018

Thanks so much! I will try this.

@pzhaonet pzhaonet closed this Sep 28, 2018

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