Skip to content

Commit 81974fe

Browse files
author
Linh Vo
committed
update timestamp for input-defintion
1 parent 5fdd152 commit 81974fe

6 files changed

+47
-14
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The sample dataset contains stargazer and language data for Github projects whic
1212
* `language.csv`: languageID, projectID
1313
* `stargazer.csv`: stargazerID, projectID, timestamp(starred)
1414
* `input_definition.json`: input definition in JSON format
15-
* `json_input.json`: data in JSON format with repo_id, language_id, stargazer_id defined in input_defintion.json
15+
* `json_input.json`: data in JSON format with repo_id, language_id, stargazer_id, time_value defined in input_defintion.json
1616
## Usage
1717

1818
1. Pilosa server should be running: [Starting Pilosa](https://www.pilosa.com/docs/getting-started/#starting-pilosa)

build_definition.py

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ def build(self, filepath=None):
4848
"valueDestination": "value-to-row"
4949
}
5050
]
51+
},
52+
{
53+
"name": "time_value",
54+
"actions": [
55+
{
56+
"frame": "stargazer",
57+
"valueDestination": "set-timestamp"
58+
}
59+
]
5160
}
5261
]
5362
input_def = json.dumps(definition, indent=4, sort_keys=True)
@@ -66,6 +75,7 @@ def build_language_map(cls, fname):
6675
store[x.strip()] = i
6776
return store
6877

78+
6979
def main():
7080
st = InputDefinition()
7181
if len(sys.argv) == 2:

build_json_input.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, path=os.getcwd(), token=None):
1414

1515
def search(self, query):
1616
data = []
17-
json_input = open(self.get_path("json_input.txt"), "w")
17+
json_input = open(self.get_path("json_input.json"), "w")
1818
gh = Github(self.token)
1919
search = gh.search_repositories(query, sort='stars')
2020
for repo in search:
@@ -27,6 +27,7 @@ def search(self, query):
2727

2828
for stargazer in stargazers:
2929
field["stargazer_id"] = stargazer.user.id
30+
field["time_value"] = stargazer.starred_at.strftime("%Y-%m-%dT%H:%S")
3031

3132
data.append(field)
3233
input_data = json.dumps(data, indent=4, sort_keys=True)

input_definition.json

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"HTML": 9,
3737
"Java": 21,
3838
"JavaScript": 13,
39+
"Jupyter Notebook": 62,
3940
"Lex": 55,
4041
"Logos": 11,
4142
"Lua": 36,
@@ -85,6 +86,15 @@
8586
}
8687
],
8788
"name": "stargazer_id"
89+
},
90+
{
91+
"actions": [
92+
{
93+
"frame": "stargazer",
94+
"valueDestination": "set-timestamp"
95+
}
96+
],
97+
"name": "time_value"
8898
}
8999
],
90100
"frames": [

json_input.json

+22-11
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,67 @@
22
{
33
"language_id": "CSS",
44
"repo_id": 40127179,
5-
"stargazer_id": 38705
5+
"stargazer_id": 19350078,
6+
"time_value": "2017-07-05T08:07"
67
},
78
{
89
"language_id": "Protocol Buffer",
910
"repo_id": 69703885,
10-
"stargazer_id": 19232
11+
"stargazer_id": 175499,
12+
"time_value": "2017-07-01T00:37"
1113
},
1214
{
1315
"language_id": "Protocol Buffer",
1416
"repo_id": 54616262,
15-
"stargazer_id": 20075694
17+
"stargazer_id": 20075694,
18+
"time_value": "2017-06-10T13:29"
1619
},
1720
{
1821
"language_id": "Makefile",
1922
"repo_id": 81382053,
20-
"stargazer_id": 13435194
23+
"stargazer_id": 13435194,
24+
"time_value": "2017-05-09T13:34"
2125
},
2226
{
2327
"language_id": "Java",
2428
"repo_id": 86457865,
25-
"stargazer_id": 5028504
29+
"stargazer_id": 5028504,
30+
"time_value": "2017-06-15T14:08"
2631
},
2732
{
2833
"language_id": "Protocol Buffer",
2934
"repo_id": 81125398,
30-
"stargazer_id": 15963480
35+
"stargazer_id": 15963480,
36+
"time_value": "2017-06-08T13:20"
3137
},
3238
{
3339
"language_id": "Protocol Buffer",
3440
"repo_id": 92058858,
35-
"stargazer_id": 513114
41+
"stargazer_id": 513114,
42+
"time_value": "2017-05-23T22:19"
3643
},
3744
{
3845
"language_id": "Makefile",
3946
"repo_id": 94591050,
40-
"stargazer_id": 770790
47+
"stargazer_id": 770790,
48+
"time_value": "2017-06-20T04:28"
4149
},
4250
{
4351
"language_id": "Protocol Buffer",
4452
"repo_id": 92607224,
45-
"stargazer_id": 3055345
53+
"stargazer_id": 3055345,
54+
"time_value": "2017-06-07T08:43"
4655
},
4756
{
4857
"repo_id": 90106646,
49-
"stargazer_id": 513114
58+
"stargazer_id": 513114,
59+
"time_value": "2017-06-07T15:52"
5060
},
5161
{
5262
"language_id": "Go",
5363
"repo_id": 91720568,
54-
"stargazer_id": 513114
64+
"stargazer_id": 513114,
65+
"time_value": "2017-05-18T20:40"
5566
},
5667
{
5768
"language_id": "Go",

languages.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ TeX
5959
TypeScript
6060
GDB
6161
GAP
62-
Gnuplot
62+
Gnuplot
63+
Jupyter Notebook

0 commit comments

Comments
 (0)