File size: 3,690 Bytes
ac6c40f
 
13fd677
 
 
 
 
 
 
ac6c40f
13fd677
 
 
 
 
ac6c40f
57616af
ac6c40f
13fd677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac6c40f
57616af
ac6c40f
13fd677
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

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

N_FIELDS_PII = 3
N_FIELDS_LICENSES = 3
N_FIELDS_LIMITATIONS = 4

N_FIELDS = N_FIELDS_PII + N_FIELDS_LICENSES + N_FIELDS_LIMITATIONS


def considerations_page():
    st.session_state.card_dict["considerations"] = st.session_state.card_dict.get(
        "considerations", {}
    )
    with st.expander("PII Risks and Liability", expanded=False):
        key_pref = ["considerations", "pii"]
        st.session_state.card_dict["considerations"]["pii"] = st.session_state.card_dict[
            "considerations"
        ].get("pii", {})

        # TODO: cross-link this section with curation.

    with st.expander("Licenses", expanded=False):
        key_pref = ["considerations", "licenses"]
        st.session_state.card_dict["considerations"]["licenses"] = st.session_state.card_dict[
            "considerations"
        ].get("licenses", {})

        # TODO: cross-link the first question with overview.py.

        make_text_input(
            label="Can the dataset be used for research and/or commercial purposes?",
            key_list=key_pref + ["data-restrictions"],
            help="Describe any restrictions put on how the data can be used.",
        )
        make_radio(
            label="Are thre restrictions on the underlying data?",
            options=["Open", "Non-Commercial", "Copyrighted", "Other"],
            key_list=key_pref + ["data-copyright"],
            help="Are there restructions on the underlying data?",
        )

    with st.expander("Known limitations", expanded=False):
        key_pref = ["considerations", "limitations"]
        st.session_state.card_dict["considerations"]["limitations"] = st.session_state.card_dict[
            "considerations"
        ].get("limitations", {})

        # TODO: Form proper language

        make_text_area(
            label="Technical limitations, annotation noise, etc.",
            key_list=key_pref + ["data-technical-limitations"],
            help="",
        )

        make_text_area(
            label="Particularly unsuited for applications",
            key_list=key_pref + ["data-unsuited-applications"],
            help="",
        )

        make_text_area(
            label="What are discouraged use cases of the dataset?",
            key_list=key_pref + ["data-discouraged-use"],
            help="",
        )

        make_text_area(
            label="Citation of work identifying these limitations",
            key_list=key_pref + ["data-citations-limitations"],
            help="",
        )


def considerations_summary():
    total_filled = sum(
        [len(dct) for dct in st.session_state.card_dict.get("considerations", {}).values()]
    )
    with st.expander(
        f"Dataset Overview Completion - {total_filled} of {N_FIELDS}", expanded=False
    ):
        completion_markdown = ""
        completion_markdown += (
            f"- **Overall competion:**\n  - {total_filled} of {N_FIELDS} fields\n"
        )
        completion_markdown += f"- **Sub-section - PII Risks and Liability:**\n  - {len(st.session_state.card_dict.get('considerations', {}).get('pii', {}))} of {N_FIELDS_PII} fields\n"
        completion_markdown += f"- **Sub-section - Licenses:**\n  - {len(st.session_state.card_dict.get('considerations', {}).get('licenses', {}))} of {N_FIELDS_LICENSES} fields\n"
        completion_markdown += f"- **Sub-section - Known limitations:**\n  - {len(st.session_state.card_dict.get('considerations', {}).get('limitations', {}))} of {N_FIELDS_LIMITATIONS} fields\n"
        st.markdown(completion_markdown)