Skip to content

Commit

Permalink
Sort yaml files before export, to avoid OS differences
Browse files Browse the repository at this point in the history
  • Loading branch information
idris committed Jan 21, 2024
1 parent 29d1211 commit c277bdd
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def export_to_csv(input_dir, output_csv, schema_file):
# Write header based on the schema
writer.writeheader()

for yaml_file in os.listdir(input_dir):
for yaml_file in sorted(os.listdir(input_dir)):
if yaml_file.endswith(".yaml"):
yaml_file_path = os.path.join(input_dir, yaml_file)
with open(yaml_file_path, 'r') as file:
Expand All @@ -43,7 +43,7 @@ def export_to_csv(input_dir, output_csv, schema_file):
def convert_yaml_to_json(directory_path, key):
data = {}

for file_name in os.listdir(directory_path):
for file_name in sorted(os.listdir(directory_path)):
if file_name.endswith(".yaml"):
file_path = os.path.join(directory_path, file_name)
with open(file_path, 'r') as yaml_file:
Expand Down
18 changes: 9 additions & 9 deletions output/csv/brands.csv
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
id,name,description,status,reasons,countries,categories,website,logo_url,alternatives,alternatives_text,allOf
sabra,Sabra,"Sabra was an Isareli hummus company, and is now a joint venture between Pepsi and Strauss. Strauss is an Israeli food company.",avoid,operations_in_israel,,food,https://sabra.com/,,,Most hummus is not Israeli. Any non-Israeli hummus at your local grocery store is preferred over Sabra.,
sodastream,SodaStream,"SodaStream has long been a BDS target due to their operation of factories on stolen land and their racial discrimination against Palestinian workers.[^1]

[^1]: https://bdsmovement.net/Act-Now-Against-These-Companies-Profiting-From-Genocide",avoid,operations_in_israel,global,,https://sodastream.com/,https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Soda_Stream_Logo.svg/2560px-Soda_Stream_Logo.svg.png,drinkmate,,
puma,Puma,"The Palestinian BDS National Committee has called for a boycott of Puma[^1] for several reasons, including their
sponsorship of the Israeli Football Association (IFA), which includes teams in illegal settlements on occupied
Palestinian land.

[^1]: https://bdsmovement.net/boycott-puma",avoid,operations_in_israel,global,,,,,,
ahava,Ahava,"Ahava is an Israeli cosmetics company which operates its main manufacturing plant and showroom in Mitzpe Shalem,
an illegal settlement in the West Bank.[^1]
The Palestinian BDS National Committee has called for a boycott of Ahava.[^2]

[^1]: https://en.wikipedia.org/wiki/Ahava
[^2]: https://bdsmovement.net/Act-Now-Against-These-Companies-Profiting-From-Genocide",avoid,"operations_in_settlements, operations_in_israel",global,,https://www.ahava.com/,https://upload.wikimedia.org/wikipedia/commons/8/81/AhavaLogo.png,,,
drinkmate,Drinkmate,Drinkmate offers sparkling water and soda makers (also known as soda machines).,neutral,,"us, ca, gb, eu, au, co, pe, ae, sa, jp, sg, tw",,https://idrinkproducts.com/,,,,
puma,Puma,"The Palestinian BDS National Committee has called for a boycott of Puma[^1] for several reasons, including their
sponsorship of the Israeli Football Association (IFA), which includes teams in illegal settlements on occupied
Palestinian land.

[^1]: https://bdsmovement.net/boycott-puma",avoid,operations_in_israel,global,,,,,,
sabra,Sabra,"Sabra was an Isareli hummus company, and is now a joint venture between Pepsi and Strauss. Strauss is an Israeli food company.",avoid,operations_in_israel,,food,https://sabra.com/,,,Most hummus is not Israeli. Any non-Israeli hummus at your local grocery store is preferred over Sabra.,
sodastream,SodaStream,"SodaStream has long been a BDS target due to their operation of factories on stolen land and their racial discrimination against Palestinian workers.[^1]

[^1]: https://bdsmovement.net/Act-Now-Against-These-Companies-Profiting-From-Genocide",avoid,operations_in_israel,global,,https://sodastream.com/,https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Soda_Stream_Logo.svg/2560px-Soda_Stream_Logo.svg.png,drinkmate,,
96 changes: 48 additions & 48 deletions output/json/data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
{
"brands": {
"ahava": {
"id": "ahava",
"name": "Ahava",
"status": "avoid",
"reasons": [
"operations_in_settlements",
"operations_in_israel"
],
"countries": [
"global"
],
"website": "https://www.ahava.com/",
"logo_url": "https://upload.wikimedia.org/wikipedia/commons/8/81/AhavaLogo.png",
"description": "Ahava is an Israeli cosmetics company which operates its main manufacturing plant and showroom in Mitzpe Shalem, \nan illegal settlement in the West Bank.[^1]\nThe Palestinian BDS National Committee has called for a boycott of Ahava.[^2]\n\n[^1]: https://en.wikipedia.org/wiki/Ahava\n[^2]: https://bdsmovement.net/Act-Now-Against-These-Companies-Profiting-From-Genocide"
},
"drinkmate": {
"id": "drinkmate",
"name": "Drinkmate",
"status": "neutral",
"countries": [
"us",
"ca",
"gb",
"eu",
"au",
"co",
"pe",
"ae",
"sa",
"jp",
"sg",
"tw"
],
"website": "https://idrinkproducts.com/",
"description": "Drinkmate offers sparkling water and soda makers (also known as soda machines)."
},
"puma": {
"id": "puma",
"name": "Puma",
"status": "avoid",
"reasons": [
"operations_in_israel"
],
"countries": [
"global"
],
"description": "The Palestinian BDS National Committee has called for a boycott of Puma[^1] for several reasons, including their \nsponsorship of the Israeli Football Association (IFA), which includes teams in illegal settlements on occupied \nPalestinian land.\n\n[^1]: https://bdsmovement.net/boycott-puma"
},
"sabra": {
"id": "sabra",
"name": "Sabra",
Expand Down Expand Up @@ -54,54 +102,6 @@
"percent": 50
}
]
},
"puma": {
"id": "puma",
"name": "Puma",
"status": "avoid",
"reasons": [
"operations_in_israel"
],
"countries": [
"global"
],
"description": "The Palestinian BDS National Committee has called for a boycott of Puma[^1] for several reasons, including their \nsponsorship of the Israeli Football Association (IFA), which includes teams in illegal settlements on occupied \nPalestinian land.\n\n[^1]: https://bdsmovement.net/boycott-puma"
},
"ahava": {
"id": "ahava",
"name": "Ahava",
"status": "avoid",
"reasons": [
"operations_in_settlements",
"operations_in_israel"
],
"countries": [
"global"
],
"website": "https://www.ahava.com/",
"logo_url": "https://upload.wikimedia.org/wikipedia/commons/8/81/AhavaLogo.png",
"description": "Ahava is an Israeli cosmetics company which operates its main manufacturing plant and showroom in Mitzpe Shalem, \nan illegal settlement in the West Bank.[^1]\nThe Palestinian BDS National Committee has called for a boycott of Ahava.[^2]\n\n[^1]: https://en.wikipedia.org/wiki/Ahava\n[^2]: https://bdsmovement.net/Act-Now-Against-These-Companies-Profiting-From-Genocide"
},
"drinkmate": {
"id": "drinkmate",
"name": "Drinkmate",
"status": "neutral",
"countries": [
"us",
"ca",
"gb",
"eu",
"au",
"co",
"pe",
"ae",
"sa",
"jp",
"sg",
"tw"
],
"website": "https://idrinkproducts.com/",
"description": "Drinkmate offers sparkling water and soda makers (also known as soda machines)."
}
},
"companies": {
Expand Down

0 comments on commit c277bdd

Please sign in to comment.