Sebastian Gehrmann commited on
Commit
8c3bdec
1 Parent(s): b7fbd2a

add formatting

Browse files
app.py CHANGED
@@ -35,7 +35,7 @@ st.set_page_config(
35
  page_description = """
36
  # GEM Data Card Input Form
37
 
38
- This application was designed to support the GEM v2 data hackathon.
39
 
40
  It allows users to fill out all of the information going into the data documentation when submitting a new dataset.
41
 
@@ -43,6 +43,8 @@ Use the left sidebar to navigate:
43
  - "**Dataset at a Glance**" shows selected information and tracks progress
44
  - Each of the "**Section:**" pages opens a form for a specific section of the card
45
  - Go to "**Review and Save**" when you are done to save your data card
 
 
46
  """
47
 
48
  _N_FIELDS = datacards.considerations.N_FIELDS + \
 
35
  page_description = """
36
  # GEM Data Card Input Form
37
 
38
+ This application was designed for GEM.
39
 
40
  It allows users to fill out all of the information going into the data documentation when submitting a new dataset.
41
 
 
43
  - "**Dataset at a Glance**" shows selected information and tracks progress
44
  - Each of the "**Section:**" pages opens a form for a specific section of the card
45
  - Go to "**Review and Save**" when you are done to save your data card
46
+
47
+ Please use **markdown** formatting for each field.
48
  """
49
 
50
  _N_FIELDS = datacards.considerations.N_FIELDS + \
datacards/overview.py CHANGED
@@ -34,7 +34,7 @@ def overview_page():
34
  st.session_state.card_dict["overview"] = st.session_state.card_dict.get(
35
  "overview", {}
36
  )
37
- with st.expander("Where to find the data and its documentation", expanded=True):
38
  key_pref = ["overview", "what"]
39
  st.session_state.card_dict["overview"]["what"] = st.session_state.card_dict[
40
  "overview"
 
34
  st.session_state.card_dict["overview"] = st.session_state.card_dict.get(
35
  "overview", {}
36
  )
37
+ with st.expander("What is this dataset?", expanded=True):
38
  key_pref = ["overview", "what"]
39
  st.session_state.card_dict["overview"]["what"] = st.session_state.card_dict[
40
  "overview"
formatting/key_to_question.json CHANGED
@@ -1,6 +1,17 @@
1
  {
2
  "overview": {
3
  "section-title": "Dataset Overview",
 
 
 
 
 
 
 
 
 
 
 
4
  "where": {
5
  "section-title": "Where to find the Data and its Documentation",
6
  "website": {
 
1
  {
2
  "overview": {
3
  "section-title": "Dataset Overview",
4
+ "what": {
5
+ "section-title": "What is this dataset?",
6
+ "dataset": {
7
+ "title": "Summary",
8
+ "info": "Provide a summary of this dataset in 3-4 sentences.",
9
+ "flags": [
10
+ "quick"
11
+ ],
12
+ "scope": "telescope"
13
+ }
14
+ },
15
  "where": {
16
  "section-title": "Where to find the Data and its Documentation",
17
  "website": {
formatting/reformat_json.py CHANGED
@@ -52,10 +52,16 @@ def construct_json(dataset_name: str, data_card_data: dict, text_by_key: dict):
52
  authors = data_card_data["overview"]["credit"]["creators"]
53
  except KeyError:
54
  authors = ""
 
 
 
 
 
 
55
 
56
  new_json = {
57
  "name": dataset_name,
58
- "summary": "Placeholder",
59
  "sections": [
60
  ],
61
  }
@@ -94,9 +100,10 @@ def construct_json(dataset_name: str, data_card_data: dict, text_by_key: dict):
94
  total_questions += 1
95
  answer = data_card_data[main_key][second_key].get(final_key, "N/A")
96
  except:
97
- print(main_key, second_key, final_key)
98
- print("==="*50)
99
- print(data_card_data)
 
100
  # Skip empty answers.
101
  if isinstance(answer, str):
102
  if answer.lower() == "n/a":
@@ -140,6 +147,7 @@ if __name__ == "__main__":
140
  data_card_data = read_json_file(data_card_path)
141
  data_card_json, total_cur_words = construct_json(dataset, data_card_data, text_by_key)
142
  total_words_across_everything += total_cur_words
 
143
  save_file(new_path, data_card_json)
144
  else:
145
  print(f"{dataset} has no data card!")
 
52
  authors = data_card_data["overview"]["credit"]["creators"]
53
  except KeyError:
54
  authors = ""
55
+ try:
56
+ summary = data_card_data["overview"]["what"]["dataset"]
57
+ except KeyError:
58
+ summary = "Placeholder"
59
+
60
+
61
 
62
  new_json = {
63
  "name": dataset_name,
64
+ "summary": summary,
65
  "sections": [
66
  ],
67
  }
 
100
  total_questions += 1
101
  answer = data_card_data[main_key][second_key].get(final_key, "N/A")
102
  except:
103
+ # print(main_key, second_key, final_key)
104
+ # print("==="*50)
105
+ # print(data_card_data)
106
+ continue
107
  # Skip empty answers.
108
  if isinstance(answer, str):
109
  if answer.lower() == "n/a":
 
147
  data_card_data = read_json_file(data_card_path)
148
  data_card_json, total_cur_words = construct_json(dataset, data_card_data, text_by_key)
149
  total_words_across_everything += total_cur_words
150
+
151
  save_file(new_path, data_card_json)
152
  else:
153
  print(f"{dataset} has no data card!")