Skip to content
Closed
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
14 changes: 13 additions & 1 deletion 02_activities/assignments/DC_Cohort/Assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ Please do not pick the exact same tables that I have already diagrammed. For exa

***

## Response to section 1: The Logical data model for customer and customer_purchases

<img src="./images/Farmersmarket_conceptual_model.png"


## Section 2:
You can start this section following *session 2*.

Expand Down Expand Up @@ -208,6 +213,13 @@ Link if you encounter a paywall: https://archive.is/srKHV or https://web.archive
Consider, for example, concepts of fariness, inequality, social structures, marginalization, intersection of technology and society, etc.


## Response to Section 4.
```
Your thoughts...
Given my research on HIV transmission dynamic modeling involving large datasets reporting the lived experience of sex workers from various clinics and community organizations in Kenya. Some of these data are routinely collected from clinics or organizations offering HIV prevention intervention programs specifically to sex workers. Some of the people collecting data through surveys are designed in collaboration with public health researchers and community workers to generate reports and inform policymakers about program strategies that could serve this community. Most of these data only describe individuals who are registered in the program; thus, unregistered individuals are often omitted, leading to misinterpretation in reports and in the program's reach to such people. However, these data are relevant to questioning the hypothesis of program-approach priority. Most programs are meant for individuals who have self-identified as sex workers, and this often misses individuals who are faced with various structural factors, such as policing, stigmatization, etc., from reaching or accessing these programs. Thus, these challenges may affect ensuring that the data used could also enhance equity in program access by considering potential locations (reports from these locations, either physical spaces or virtual spaces) where people meet or solicit for sex.

For instance, when measuring program success by the number of people reached, we also have to consider the extent of indirect benefits achieved through the programs delivered. In other words, the population-level impact is of utmost priority, since we would achieve both direct and indirect benefits given limited resources – this raises the challenge of identifying individuals with unmet needs as well as those who should be prioritized. Not just who, but also when, given that age is a barrier to accessing programs. In addition, places where individual visits for the formation of their sexual partnership also matter. Therefore, bringing all these together in modeling the impact of programs would make decisions more efficient and inclusive.

Going back to the traditional medium of program implementation and data collection, young women in sex work who are less than 18, and those who do not yet identify as sex workers but do engage in sexual activities with multiple partners, would often be overlooked. In terms of places, there could be an overlap, resulting in double counting and misinterpretation of individuals’ primary place of registration. These could broadly be due to some circumstances like age, income stigma, and mobility, and if not addressed in the data, could impact decisions around HIV prevention resource allocation.

Connecting my experience with the article, one thing I could identify is the issue of classification decisions, which in turn shapes recognition and visibility. The article describes direct barriers to essential services, whereas my experience and work focus on fairness in representation and informing decisions. Generally, there is a need to address trade-offs, not necessarily by providing more detailed data with improved representation, as privacy risk and reporting burden may increase; rather, better involvement of sex workers in defining categories and interpreting findings could be a potential solution. With sex workers being involved in data reporting and interpretation, we may find responses to what value is being prioritized, including whose experience is less visible, and what consequence could follow.
```
29 changes: 27 additions & 2 deletions 02_activities/assignments/DC_Cohort/Assignment2.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,23 @@ The store wants to keep customer addresses. Propose two architectures for the CU

**HINT:** search type 1 vs type 2 slowly changing dimensions.


## Prompt 1
<img src="./images/small_bookstore_logical_model.drawio.png" width="500">

## Prompt 2
<img src="./images/bookstore_logical_model_employee_shifts.drawio.png" width="500">

## Prompt 3
```
Your answer...
The bookstore could manage customer addresses in two ways, depending on whether it needs to keep previous addresses. These two ways include Type 1, which overwrites the previous address, and Type 2, which keeps a history of address changes. Both designs assume that each customer has one current address.

For Type 1: overwrite the previous address. We will design the customer address table to include the customer id, address, city, province, postal code, country, and updated_at columns. The updated_at field will be populated when a customer changes their address. This update can only be done or replaced in the store, since each customer has one row linked to the customer table through customer id. For example, if a customer moves from 12 King Street to 45 Queen Street, the new address replaces the old one. The previous address would no longer be available in this table. Type 1 slowly changes dimension by overwriting previous values.

Type 2: keep a history of address changes will have a table with the same customer and address columns, plus columns to show every version of the address and its validity, including the current address. Such columns would be address version, valid from, valid to, and is current. With these, we would be able to identify each address version, when it applies, and indicate whether it is the current address. This approach means that when a customer relocates, the store would keep the previous address row, record its end date, and mark it as no longer current. It would then add a new row containing the new address and its start date. The new row would be marked as current, with no end date until the address changes again. Thereby, allowing a customer to have several address records, but only one would be current. Therefore, Type 2 preserves previous addresses while recording new ones.
```


***

## Section 2:
Expand Down Expand Up @@ -192,5 +205,17 @@ Consider, for example, concepts of labour, bias, LLM proliferation, moderating c


```
Your thoughts...
Boykis's description of hidden work behind ImageNet has raised questions about whether we recognize the human effort or input in programming artificial intelligence (AI). Most people tend to celebrate AI's work, especially when they look at AI-generated images or viral AI videos for entertainment and to make some money, without appreciating the human labor that made it possible. For instance, consider how much effort goes into looking at the computer, from every graphic to every decision made about the image outputs. These human decisions on AI outputs may seem small, but together they help build a system that later receives praise for its intelligence.

Considering fairness in the workplace as an ethical concern, researchers and AI implementers, including data modelers, deserve recognition for their workforce and meaningful contributions to the design of useful systems. Recognition from their organizations could take the form of time-reflective remuneration and, most importantly, the freedom to question unclear instructions and irregularities at work without being wrongly judged. Typically, this shows that fairness is more than just remuneration, especially when human effort is essential to decision-making. For example, in image classification, one person labels each image, whereas another decides which category it should be assigned to.

In the article by Boykis, there were highlights on how human decisions are traced through ImageNet and earlier computer language resources. Thus, there is a sort of dependence on human decision and/or judgment as stated by Boykis: “every single piece of decision-making in a high-tech neural network initially rests on a human being”

Consequently, deciding whether one appears trustworthy in a photograph does not establish honesty; this is the essence: accurate labeling is not always the right goal. This is because some decisions may be based on stereotypes rather than reliable evidence. Therefore, it is ethical to question both the appropriateness of the label and its availability where necessary.

Furthermore, once these decisions are embedded in a system, human effort tends to diminish. And these are also what we face in the modern job sectors, where systems are automated to judge or assess job applicants. And tracing wrong judgments would be impossible except if those who created the training data, technology guides, and automated the system are also collectively involved in the selection process, rather than basing the outcome on an individual effort. This shows that most decisions made by a computer system are objective at times.

Expanding the use of AI should prompt questions about the conditions under which human judgments are collected and whose perspectives those judgments represent, especially when it involves LLMs and content generation, to ensure the usefulness of content and the extent of harmful content generated or accessed. And ethically, the workers' rights should also be considered in the issues mentioned above.

Generally, it is important to note that Boykis's article supports a thorough assessment and implementation of technologies rather than relying on finished technology. Thus, this encourages meaningful opportunities to challenge harmful decisions. Therefore, developers should also consider the affected communities when making decisions about capturing their lived experiences or needs that might otherwise be overlooked, because some stories cannot be told without the story's owner. However, consultation and better data cannot justify every application. We must also ask whether a particular judgment should be automated at all. A system can be technically impressive while still treating workers or the people it classifies unfairly.
```
133 changes: 86 additions & 47 deletions 02_activities/assignments/DC_Cohort/assignment1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@
--SELECT
/* 1. Write a query that returns everything in the customer table. */
--QUERY 1




SELECT * FROM customer;
--END QUERY


/* 2. Write a query that displays all of the columns and 10 rows from the customer table,
sorted by customer_last_name, then customer_first_ name. */
--QUERY 2




SELECT * FROM customer
ORDER BY customer_last_name, customer_first_name
LIMIT 10;
--END QUERY


--WHERE
/* 1. Write a query that returns all customer purchases of product IDs 4 and 9.
Limit to 25 rows of output. */
--QUERY 3




SELECT * FROM customer_purchases
WHERE product_id IN (4, 9)
LIMIT 25;
--END QUERY


Expand All @@ -42,10 +37,11 @@ filtered by customer IDs between 8 and 10 (inclusive) using either:
Limit to 25 rows of output.
*/
--QUERY 4




SELECT *,
quantity * cost_per_quantity AS price
FROM customer_purchases
WHERE customer_id BETWEEN 8 AND 10
LIMIT 25;
--END QUERY


Expand All @@ -55,10 +51,14 @@ Using the product table, write a query that outputs the product_id and product_n
columns and add a column called prod_qty_type_condensed that displays the word “unit”
if the product_qty_type is “unit,” and otherwise displays the word “bulk.” */
--QUERY 5




SELECT
product_id,
product_name,
CASE
WHEN product_qty_type = 'unit' THEN 'unit'
ELSE 'bulk'
END AS prod_qty_type_condensed
FROM product;
--END QUERY


Expand All @@ -67,9 +67,18 @@ add a column to the previous query called pepper_flag that outputs a 1 if the pr
contains the word “pepper” (regardless of capitalization), and otherwise outputs 0. */
--QUERY 6




SELECT
product_id,
product_name,
CASE
WHEN product_qty_type = 'unit' THEN 'unit'
ELSE 'bulk'
END AS prod_qty_type_condensed,
CASE
WHEN LOWER(product_name) LIKE '%pepper%' THEN 1
ELSE 0
END AS pepper_flag
FROM product;
--END QUERY


Expand All @@ -78,10 +87,13 @@ contains the word “pepper” (regardless of capitalization), and otherwise out
vendor_id field they both have in common, and sorts the result by market_date, then vendor_name.
Limit to 24 rows of output. */
--QUERY 7




SELECT
v.*, vba.*
FROM vendor AS v
INNER JOIN vendor_booth_assignments AS vba
ON v.vendor_id = vba.vendor_id
ORDER BY vba.market_date, v.vendor_name
LIMIT 24;
--END QUERY


Expand All @@ -92,10 +104,10 @@ Limit to 24 rows of output. */
/* 1. Write a query that determines how many times each vendor has rented a booth
at the farmer’s market by counting the vendor booth assignments per vendor_id. */
--QUERY 8




SELECT vendor_id,
COUNT(*) AS booth_assignment_count
FROM vendor_booth_assignments
GROUP BY vendor_id;
--END QUERY


Expand All @@ -105,10 +117,19 @@ of customers for them to give stickers to, sorted by last name, then first name.

HINT: This query requires you to join two tables, use an aggregate function, and use the HAVING keyword. */
--QUERY 9




SELECT
c.customer_id,
c.customer_first_name,
c.customer_last_name,
SUM(cp.quantity * cp.cost_per_quantity) AS total_spent
FROM customer AS c
INNER JOIN customer_purchases AS cp
ON c.customer_id = cp.customer_id
GROUP BY c.customer_id,
c.customer_first_name,
c.customer_last_name
HAVING SUM(cp.quantity * cp.cost_per_quantity) > 2000
ORDER BY c.customer_last_name, c.customer_first_name;
--END QUERY


Expand All @@ -121,13 +142,21 @@ When inserting the new vendor, you need to appropriately align the columns to be
(there are five columns to be inserted, I've given you the details, but not the syntax)

-> To insert the new row use VALUES, specifying the value you want for each column:
VALUES(col1,col2,col3,col4,col5)
VALUES(10,Thomass Superfood Store,Fresh Focused,Thomas,Rosenthal)
*/
--QUERY 10




CREATE TABLE temp.new_vendor AS
SELECT * FROM vendor;

INSERT INTO temp.new_vendor (
vendor_id,
vendor_name,
vendor_type,
vendor_owner_first_name,
vendor_owner_last_name
)
VALUES (10, 'Thomass Superfood Store', 'Fresh Focused',
'Thomas', 'Rosenthal');
--END QUERY


Expand All @@ -138,10 +167,12 @@ HINT: you might need to search for strfrtime modifers sqlite on the web to know
and year are!
Limit to 25 rows of output. */
--QUERY 11




SELECT
customer_id,
STRFTIME('%m', market_date) AS month,
STRFTIME('%Y', market_date) AS year
FROM customer_purchases
LIMIT 25;
--END QUERY


Expand All @@ -153,7 +184,15 @@ but remember, STRFTIME returns a STRING for your WHERE statement...
AND be sure you remove the LIMIT from the previous query before aggregating!! */
--QUERY 12




SELECT
customer_id,
STRFTIME('%m', market_date) AS month,
STRFTIME('%Y', market_date) AS year,
SUM(quantity * cost_per_quantity) AS total_spent
FROM customer_purchases
WHERE STRFTIME('%m', market_date) = '04'
AND STRFTIME('%Y', market_date) = '2022'
GROUP BY customer_id,
STRFTIME('%m', market_date),
STRFTIME('%Y', market_date);
--END QUERY
Loading
Loading