Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/analytics/UserAnalytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def build_user_summary_dict(self):

return user_summary

def profile_preference_selections(self):
profile_data = self.get_profile_data()
preference_data = self.get_preferences_data()

profile_fields = ["religions", "ethnicities", "smoking", "drinking", "marijuana", "drugs", "children", "family_plans", "education_attained", "politics"]
preference_fields = ["religion_preference", "ethnicity_preference", "smoking_preference", "drinking_preference", "marijuana_preference", "drugs_preference", "children_preference", "family_plans_preference", "education_attained_preference", "politics_preference"]

profile_values = [profile_data[field] for field in profile_fields if field in profile_data]
preference_values = [preference_data[field] for field in preference_fields if field in preference_data]

return profile_values, preference_values

def count_displayed_attributes(self):
profile_data = self.get_profile_data()

Expand Down
40 changes: 39 additions & 1 deletion app/pages/UserPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@

from analytics.UserAnalytics import UserAnalytics

def potential_misalignments():
# define categories
categories = ["Religion", "Ethnicity", "Smoking", "Drinking", "Marijuana", "Drugs", "Children", "Family Plans", "Education", "Politics"]

profile_selections, preferences_selections = UserAnalytics().profile_preference_selections()

# create table with two data columns
fig = go.Figure(data=[go.Table(
header=dict(values=["Category", "User Profile", "User Preferences"],
fill_color="lightgrey",
align="left"),
cells=dict(values=[categories, profile_selections, preferences_selections],
fill_color="white",
align="left")
)])

fig.update_layout(title="Profile Visibility Comparison Between User A and User B")

return dmc.Card(
children=[
dmc.Space(h=10),
dmc.Text("Does this person’s dating criteria match how they present themselves?", weight=700, size="xl"),
dmc.Space(h=10),
dmc.Text("This shows potential alignment or misalignment between the users profile and their preferences.", size="md"),
dmc.Space(h=10),
dcc.Graph(figure=fig)
],
withBorder=True,
shadow="sm",
radius="md",
style={"height": "400px"},
)


def disclosure_vs_privacy():
category_counts = UserAnalytics().count_displayed_attributes()

Expand Down Expand Up @@ -49,6 +83,8 @@ def disclosure_vs_privacy():
dmc.Space(h=10),
dmc.Text("How much information does this user choose to share vs. keep private?", weight=700, size="xl"),
dmc.Space(h=10),
dmc.Text("Looks at displayed vs. not displayed attributes (ethnicity, religion, workplaces, dating intentions etc. and helps identify if the user is open vs. private about certain topics.", size="md"),
dmc.Space(h=10),
dcc.Graph(figure=fig)
],
withBorder=True,
Expand Down Expand Up @@ -166,5 +202,7 @@ def create_user_summary_card():
],
style={"height": "50vh"} ),
dmc.Space(h=120),
disclosure_vs_privacy()
disclosure_vs_privacy(),
potential_misalignments(),
dmc.Space(h=50)
])
37 changes: 35 additions & 2 deletions tests/analytics/test_UserAnalytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,21 @@
"height_centimeters": 213,
"gender": "female",
"gender_identity_displayed": false,
"ethnicities": "[Prefer Not to Say]",
"ethnicities_displayed": false,
"religions": "[Prefer Not to Say]",
"religions_displayed": true,
"workplaces_displayed": false,
"schools_displayed": true,
"job_title": "Astronaut",
"job_title_displayed": true,
"hometowns_displayed": false,
"smoking": "[Prefer Not to Say]",
"drinking": "[Prefer Not to Say]",
"drugs": "[Prefer Not to Say]",
"marijuana": "[Prefer Not to Say]",
"children": "[Prefer Not to Say]",
"family_plans": "[Prefer Not to Say]",
"smoking_displayed": false,
"drinking_displayed": true,
"marijuana_displayed": false,
Expand All @@ -68,7 +76,27 @@
"preferences": {
"distance_miles_max": 50,
"age_min": 98,
"age_max": 99
"age_max": 99,
"ethnicity_preference": "[Open to All]",
"ethnicity_dealbreaker": false,
"religion_preference": "[Open to All]",
"religion_dealbreaker": false,
"smoking_preference": "[Open to All]",
"smoking_dealbreaker": false,
"drinking_preference": "[Open to All]",
"drinking_dealbreaker": false,
"marijuana_preference": "[Open to All]",
"marijuana_dealbreaker": false,
"drugs_preference": "[Open to All]",
"drugs_dealbreaker": false,
"children_preference": "[Open to All]",
"children_dealbreaker": false,
"family_plans_preference": "[Open to All]",
"family_plans_dealbreaker": false,
"education_attained_preference": "[Open to All]",
"education_attained_dealbreaker": false,
"politics_preference": "[Open to All]",
"politics_dealbreaker": false
},
"location": {
"latitude": 65.00,
Expand Down Expand Up @@ -175,4 +203,9 @@ def test_build_user_location_dict(user_analytics):

def test_count_displayed_attributes(user_analytics):
result = user_analytics.count_displayed_attributes()
assert result == COUNT_DISPLAYED_ATTRIB_OUTPUT
assert result == COUNT_DISPLAYED_ATTRIB_OUTPUT

def test_profile_preference_selections(user_analytics):
profile, prefs = user_analytics.profile_preference_selections()
assert len(profile) == len(prefs)
assert len(profile) == 10