-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.R
63 lines (59 loc) · 1.56 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Lifeline
# Copyright 2015 Fabian Enos and Sachin Sancheti
# Licensed under MIT (https://github.com/sachinsancheti1/Lifeline/blob/master/LICENSE)
# This is the user-interface definition of a Shiny web application.
# You can find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com
#
library(shiny)
library(jsonlite)
library(RNeo4j)
#people <- fromJSON("import.json")
#names = paste(people$first_name,people$last_name,sep = " ")
graph = startGraph("http://localhost:7474/db/data/")
query = "MATCH n RETURN n.first_name,n.last_name,ID(n)"
nodes <- cypher(graph, query)
names <- c()
# generate the names from a data frame of nodes
for(i in 1:nrow(nodes)) {
row <- nodes[i,]
names <- c(names, paste(row$n.first_name, row$n.last_name, sep=' '))
}
id = nodes[,"ID(n)"]
tt = function(x) paste0(x,collapse = "'='")
opts = paste("'",paste0((apply(cbind(names,id),1,tt)),collapse="','"),"'",sep="")
shinyUI(fluidPage(
# Application title
titlePanel("Create your family tree"),
fluidRow(
column(6,
selectInput(
'father', 'Father', choices = setNames(id,names)
)
),
column(6,
selectInput(
'mother', 'Mother', choices = setNames(id,names)
)
)
),
fluidRow(
column(3),
column(4,
selectInput(
'children', 'Children', choices = setNames(id,names), multiple = TRUE
)
),
column(2),
column(2,
actionButton(inputId = 'submit',"Submit")
)
),
fluidRow(
wellPanel(
textOutput('jt')
)
)
)
)