File size: 3,712 Bytes
ac6c40f
 
bac5a97
 
 
 
 
 
 
ac6c40f
bac5a97
 
 
ac6c40f
bac5a97
57616af
ac6c40f
bac5a97
 
 
 
 
 
 
 
 
4081c39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bac5a97
 
 
 
 
 
 
 
 
 
 
ac6c40f
4081c39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57616af
ac6c40f
bac5a97
 
 
 
3578aa2
bac5a97
 
 
 
 
 
 
 
 
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
import streamlit as st

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

N_FIELDS_SOCIAL_IMPACT = 9
N_FIELDS_UNDERSERVED_COMMUNITIES = 8
N_FIELDS_BIASES= 3

N_FIELDS = N_FIELDS_SOCIAL_IMPACT + N_FIELDS_UNDERSERVED_COMMUNITIES + N_FIELDS_BIASES

def context_page():
    st.session_state.card_dict["context"] = st.session_state.card_dict.get(
        "context", {}
    )
    with st.expander("Social Impact of the Dataset", expanded=False):
        key_pref = ["context", "social-impact"]
        st.session_state.card_dict["context"]["social-impact"] = st.session_state.card_dict[
            "context"
        ].get("social-impact", {})

        make_text_area(
            label="What tasks has this dataset been used for previously?",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Did any of these previous uses result in observations about the dataset?",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Have any changes been made to the dataset as a result of these observations?",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Task",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Dataset-specific",
            key_list=key_pref + [""],
            help="",
        )


    with st.expander("Impact on Under-Served Communities", expanded=False):
        key_pref = ["context", "underserved"]
        st.session_state.card_dict["context"]["underserved"] = st.session_state.card_dict[
            "context"
        ].get("underserved", {})

    with st.expander("Discussion of Biases", expanded=False):
        key_pref = ["context", "biases"]
        st.session_state.card_dict["context"]["biases"] = st.session_state.card_dict[
            "context"
        ].get("biases", {})

        make_text_area(
            label="Are there documented biases in the data?",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Link to analyses",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="How does the distribution of language producers differ from a base distribution?",
            key_list=key_pref + [""],
            help="",
        )

        make_text_area(
            label="Topic coverage?",
            key_list=key_pref + [""],
            help="",
        )


def context_summary():
    total_filled = sum(
        [len(dct) for dct in st.session_state.card_dict.get("context", {}).values()]
    )
    with st.expander(
        f"Broader Social Context 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 - Social Impact of the Dataset:**\n  - {len(st.session_state.card_dict.get('context', {}).get('social-impact', {}))} of {N_FIELDS_SOCIAL_IMPACT} fields\n"
        completion_markdown += f"- **Sub-section - Impact on Under-Served Communities:**\n  - {len(st.session_state.card_dict.get('context', {}).get('underserved', {}))} of {N_FIELDS_UNDERSERVED_COMMUNITIES} fields\n"
        completion_markdown += f"- **Sub-section - Discussion of Biases:**\n  - {len(st.session_state.card_dict.get('context', {}).get('biases', {}))} of {N_FIELDS_BIASES} fields\n"
        st.markdown(completion_markdown)