File size: 12,368 Bytes
ac6c40f
 
 
 
 
 
 
 
 
 
 
 
 
 
d1a58c9
8a2ec29
ac6c40f
 
57616af
ac6c40f
 
 
 
57616af
 
 
ac6c40f
 
 
 
 
57616af
ac6c40f
57616af
 
 
b03f385
ac6c40f
57616af
 
 
ac6c40f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0bf11
ac6c40f
 
 
 
 
 
 
 
 
8a2ec29
 
 
 
 
 
 
 
 
 
 
 
 
 
ac6c40f
 
 
 
 
 
 
 
 
 
 
 
57616af
 
 
ac6c40f
 
 
 
 
 
 
 
 
57616af
ac6c40f
 
d1a58c9
 
 
 
 
 
 
 
 
 
ac6c40f
 
 
ce0bf11
ac6c40f
 
 
 
 
57616af
ac6c40f
ce0bf11
 
 
 
 
 
05d58bc
 
 
ce0bf11
b03f385
ac6c40f
 
57616af
8a2ec29
57616af
 
 
 
 
 
 
 
 
 
ce0bf11
57616af
b03f385
ac6c40f
ce0bf11
 
e0a15f4
ce0bf11
 
 
05d58bc
 
 
ac6c40f
 
 
 
 
 
 
57616af
 
 
8a2ec29
 
 
 
 
 
 
 
 
 
ac6c40f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13fd677
 
 
ac6c40f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57616af
 
 
 
 
 
ac6c40f
57616af
9994065
57616af
ac6c40f
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
import json
import streamlit as st

from os.path import join as pjoin

from .streamlit_utils import (
    make_multiselect,
    make_selectbox,
    make_text_area,
    make_text_input,
    make_radio,
)

N_FIELDS_WHERE = 9
N_FIELDS_LANGUAGES = 8
N_FIELDS_CREDIT = 5
N_FIELDS_STRUCTURE = 7

N_FIELDS = N_FIELDS_WHERE + N_FIELDS_LANGUAGES + N_FIELDS_CREDIT + N_FIELDS_STRUCTURE


languages_bcp47 = [
    x
    for x in json.load(open(pjoin("resources", "bcp47.json"), encoding="utf-8"))[
        "subtags"
    ]
    if x["type"] == "language"
]

license_list = json.load(open(pjoin("resources", "licenses.json"), encoding="utf-8"))


def overview_page():
    st.session_state.card_dict["overview"] = st.session_state.card_dict.get(
        "overview", {}
    )
    with st.expander("Where to find the data and its documentation", expanded=False):
        key_pref = ["overview", "where"]
        st.session_state.card_dict["overview"]["where"] = st.session_state.card_dict[
            "overview"
        ].get("where", {})
        make_text_input(
            label="What is the webpage for the dataset (if it exists)?",
            key_list=key_pref + ["website"],
            help="[URL]",
        )
        make_text_input(
            label="What is the link to where the original dataset is hosted?",
            key_list=key_pref + ["data-url"],
            help="[URL]",
        )
        make_text_input(
            label="What is the link to the paper describing the dataset (open access preferred)?",
            key_list=key_pref + ["paper-url"],
            help="[URL]",
        )
        make_text_area(
            label="Provide the BibTex-formatted reference for the dataset. Please use the correct published version (ACL anthology, etc.) instead of google scholar created Bibtex.",
            key_list=key_pref + ["paper-bibtext"],
            help="[free text]",
        )
        make_radio(
            label="Does the dataset have an active leaderboard?",
            options=["no", "yes"],
            key_list=key_pref + ["has-leaderboard"],
            help="If no, enter N/A for the following two fields",
        )
        if st.session_state.card_dict["overview"]["where"]["has-leaderboard"] == "yes":
            make_text_input(
                label="Provide a link to the leaderboard.",
                key_list=key_pref + ["leaderboard-url"],
                help="[URL] or N/A",
            )
            make_text_area(
                label="Briefly describe how the leaderboard evaluates models.",
                key_list=key_pref + ["leaderboard-description"],
                help="[free text; a paragraph] or N/A",
            )
        else:
            st.session_state.card_dict["overview"]["where"]["leaderboard-url"] = "N/A"
            st.session_state.card_dict["overview"]["where"]["leaderboard-description"] = "N/A"
        make_text_input(
            label="If known, provide the name of at least one person the reader can contact for questions about the dataset.",
            key_list=key_pref + ["contact-name"],
            help="[free text]",
        )
        make_text_input(
            label="If known, provide the email of at least one person the reader can contact for questions about the dataset.",
            key_list=key_pref + ["contact-email"],
            help="[free text]",
        )
    with st.expander("Languages and Intended Use", expanded=False):
        key_pref = ["overview", "languages"]
        st.session_state.card_dict["overview"][
            "languages"
        ] = st.session_state.card_dict["overview"].get("languages", {})
        make_radio(
            label="Is the dataset multilingual?",
            options=["no", "yes"],
            key_list=key_pref + ["is-multilingual"],
            help="More than one language present in all of the text fields",
        )
        make_multiselect(
            label="What languages/dialects are covered in the dataset?",
            key_list=key_pref + ["language-names"],
            options=[", ".join(x["description"]) for x in languages_bcp47],
            help="This is a comprehensive list of languages obtained from the BCP-47 standard list.",
        )
        make_text_area(
            label="What dialects are covered? Are there multiple dialects per language?",
            key_list=key_pref + ["language-dialects"],
            help="[free text, paragraphs] - Describe the dialect(s) as appropriate.",
        )
        make_text_area(
            label="Whose language is in the dataset?",
            key_list=key_pref + ["language-speakers"],
            help="[free text, paragraphs] - Provide locally appropriate demographic information about the language producers, if available. Use ranges where reasonable in order to protect individuals’ privacy.",
        )
        make_text_area(
            label="What is the intended use of the dataset?",
            key_list=key_pref + ["intended-use"],
            help="[free text, paragraphs] - Describe how the dataset creators describe its purpose and intended use.",
        )
        make_selectbox(
            label="What is the license of the dataset?",
            key_list=key_pref + ["license"],
            options=license_list,
            help="select `other` if missing from list, `unkown` if not provided.",
        )
        if "other" in st.session_state.card_dict["overview"]["languages"].get("license", []):
            make_text_input(
                label="What is the 'other' license of the dataset?",
                key_list=key_pref + ["license-other"],
                help="[free text]",
            )
        else:
            st.session_state.card_dict["overview"]["languages"]["license-other"] = "N/A"


        make_selectbox(
            label="What primary task does the dataset support?",
            key_list=key_pref + ["task"],
            options=[
                "",  # default needs to be invalid value to make sure people actually fill in
                "Content Transfer",
                "Data-to-Text",
                "Dialog Response Generation",
                "Paraphrasing",
                "Question Generation",
                "Reasoning",
                "Simplification",
                "Style Transfer",
                "Summarization",
                "Text-to-Slide",
                "Other"
            ],
            help="Select `other` if the task is not included in the list.",
        )
        if "Other" in st.session_state.card_dict["overview"]["languages"].get("task", []):
            make_text_input(
                label="What is the primary task?",
                key_list=key_pref + ["task-other"],
                help="[free text]",
            )
        else:
            st.session_state.card_dict["overview"]["languages"]["task-other"] = "N/A"

        make_text_area(
            label="Provide a short description of the communicative goal of a model trained for this task on this dataset.",
            key_list=key_pref + ["communicative"],
            help="[free text, a paragraph] (e.g., describe a restaurant from a structured representation of its attributes)",
        )
    with st.expander("Credit", expanded=False):
        key_pref = ["overview", "credit"]
        st.session_state.card_dict["overview"][
            "credit"
        ] = st.session_state.card_dict.get("credit", {})
        make_multiselect(
            label="In what kind of organization did the dataset curation happen?",
            options=["industry", "academic", "independent", "other"],
            key_list=key_pref + ["organization-type"],
        )
        make_text_input(
            label="Name the organization(s).",
            key_list=key_pref + ["organization-names"],
            help="comma-separated",
        )
        make_text_input(
            label="Who created the original dataset? List the people involved in collecting the dataset and their affiliation(s).",
            key_list=key_pref + ["creators"],
            help="name (affiliation); comma-separated",
        )
        make_text_input(
            label="Who funded the data creation?",
            key_list=key_pref + ["funding"],
            help="[free text] enter N/A if unkown",
        )
        make_text_input(
            label="Who contributed to the data card and adding the dataset to GEM? List the people+affiliations involved in creating this data card and who helped integrate this dataset into GEM.",
            key_list=key_pref + ["gem-added-by"],
            help="name (affiliation); comma-separated",
        )
    with st.expander("Structure", expanded=False):
        key_pref = ["overview", "structure"]
        st.session_state.card_dict["overview"]["structure"] = st.session_state.card_dict[
            "overview"
        ].get("structure", {})
        data_fields_help = """
        [free text; paragraphs]
        - Mention their data type, and whether and how they are used as part of the generation pipeline.
        - Describe each fields' attributes, such as whether they are at the character level or word level, whether they are contiguous or not, etc.
        - If the datasets contain example IDs, state whether they have an inherent meaning, such as a mapping to other datasets or pointing to relationships between data points.
        """
        make_text_area(
            label="List and describe the fields present in the dataset.",
            key_list=key_pref + ["data-fields"],
            help=data_fields_help,
        )
        make_text_area(
            label="How was the dataset structure determined?",
            key_list=key_pref + ["structure-description"],
            help="[free text; paragraph]",
        )
        make_text_area(
            label="How were the labels chosen?",
            key_list=key_pref + ["structure-labels"],
            help="[free text; paragraph]",
        )
        make_text_area(
            label="Provide a JSON formatted example of a typical instance in the dataset.",
            key_list=key_pref + ["structure-example"],
            help="[JSON]",
        )
        make_text_area(
            label="Describe and name the splits in the dataset if there are more than one.",
            key_list=key_pref + ["structure-splits"],
            help="[free text, paragraphs] - As appropriate, provide any descriptive statistics for the features, such as size, average lengths of input and output.",
        )
        make_text_area(
            label="Describe any criteria for splitting the data, if used. If there are differences between the splits (e.g., if the training annotations are machine-generated and the dev and test ones are created by humans, or if different numbers of annotators contributed to each example), describe them here.",
            key_list=key_pref + ["structure-splits-criteria"],
            help="[free text, paragraphs]",
        )
        make_text_area(
            label="What does an outlier of the dataset in terms of length/perplexity/embedding look like?",
            key_list=key_pref + ["structure-outlier"],
            help="[free text + json formatted text/file for an example]",
        )


def overview_summary():
    total_filled = sum(
        [len(dct) for dct in st.session_state.card_dict.get("overview", {}).values()]
    )
    with st.expander(
        f"Dataset Overview Completion - {total_filled} of {N_FIELDS}", expanded=False
    ):
        completion_markdown = ""
        completion_markdown += (
            f"- **Overall completion:**\n  - {total_filled} of {N_FIELDS} fields\n"
        )
        completion_markdown += f"- **Sub-section - Where to find:**\n  - {len(st.session_state.card_dict.get('overview', {}).get('where', {}))} of {N_FIELDS_WHERE} fields\n"
        completion_markdown += f"- **Sub-section - Languages and Intended Use:**\n  - {len(st.session_state.card_dict.get('overview', {}).get('languages', {}))} of {N_FIELDS_LANGUAGES} fields\n"
        completion_markdown += f"- **Sub-section - Credit:**\n  - {len(st.session_state.card_dict.get('overview', {}).get('credit', {}))} of {N_FIELDS_CREDIT} fields\n"
        completion_markdown += f"- **Sub-section - Structure:**\n  - {len(st.session_state.card_dict.get('overview', {}).get('structure', {}))} of {N_FIELDS_STRUCTURE} fields\n"
        st.markdown(completion_markdown)