couple more (#661)

* couple more

* fix category check script

* fix whitespace

---------

Co-authored-by: Phaeton <808865+Phaeton@users.noreply.github.com>
This commit is contained in:
noah
2025-02-09 17:26:41 -05:00
committed by GitHub
parent eb6903dd3b
commit 8acda5a208
3 changed files with 19 additions and 12 deletions

View File

@@ -14762,3 +14762,6 @@ E90E07,CX-MIA,Uruguay Police,Robinson R44,R44,Pol,Police Squad,Policia,Copper Ch
E90E0E,CX-MIE,Uruguay Police,Robinson R66,R66,Pol,Police Squad,Policia,Copper Chopper,Police Forces,https://w.wiki/B3LK
E940FA,FAB-001,Gov of Bolivia,Dassault Falcon 900EX,F900,Gov,Government,Must Be Nice,Free And Fair Elections,Dictator Alert,https://w.wiki/B3LJ
E940FB,FAB-002,Gov of Bolivia,Dassault Falcon 50,FA50,Gov,Government,Must Be Nice,Free And Fair Elections,Dictator Alert,https://w.wiki/B3LJ
A9BA16,N726CP,Civil Air Patrol,Cessna 172 Skyhawk,C172,Civ,Air Force Auxiliary,Search and Rescue,Flying Vigilantes,CAP,https://w.wiki/8odd
A3494D,N3101A,Private,Cessna 170B,C170,Civ,Post-War,I am Old,All Metal,Historic,https://w.wiki/C$fM
A78833,N58479,USDA APHIS,Hughes OH-6A,H500,Gov,Beagle Brigade,Head Vet,Plant & Animal H&W,Governments,https://w.wiki/C$fk
Can't render this file because it is too large.

View File

@@ -14762,3 +14762,4 @@ E90E07,https://cdn.jetphotos.com/full/5/11822_1633572716.jpg,https://cdn.jetphot
E90E0E,https://cdn.jetphotos.com/full/6/83659_1609718717.jpg,https://cdn.jetphotos.com/full/6/16487_1581699816.jpg,,
E940FA,https://cdn.jetphotos.com/full/5/81662_1640799003.jpg,https://cdn.jetphotos.com/full/5/81662_1640799003.jpg,https://cdn.jetphotos.com/full/5/54171_1638554504.jpg,
E940FB,https://cdn.jetphotos.com/full/6/55153_1575059321.jpg,https://cdn.jetphotos.com/full/5/83758_1487098979.jpg,https://cdn.jetphotos.com/full/5/17432_1487090281.jpg,
A9BA16,https://cdn.jetphotos.com/full/5/74144_1585863438.jpg,,,
Can't render this file because it is too large.

View File

@@ -1,4 +1,4 @@
""""script to flag new/invalid categories"""
"""script to flag new/invalid categories"""
import logging
import pandas as pd
@@ -10,25 +10,30 @@ logging.basicConfig(
if __name__ == "__main__":
logging.info("Reading the main csv file...")
df = pd.read_csv("plane-alert-db.csv")
category_unique_df = pd.read_csv("plane-alert-db.csv")
category_unique_df = (
df["Category"]
category_unique_df["Category"]
.drop_duplicates()
.sort_values()
.reset_index(drop=False)
.drop("index", axis=1)
)
category_unique_df = category_unique_df.drop('index', axis=1)
logging.info(f"Total Categories in PR Count: ({category_unique_df.shape[0]}).")
logging.info("Reading the export category csv file...")
valid_df = pd.read_csv("plane-alert-categories.csv")
valid_df = (
valid_df["Category"].sort_values().reset_index(drop=False).drop("index", axis=1)
)
if not valid_df.equals(category_unique_df):
logging.info("Invalid category used!")
merged_df = valid_df.merge(category_unique_df, indicator=True, how='outer')
changed_df = merged_df[merged_df['_merge'] == 'right_only']
changed_df = changed_df.drop('_merge', axis=1)
merged_df = valid_df.merge(category_unique_df, indicator=True, how="outer")
changed_df = merged_df[merged_df["_merge"] == "right_only"]
changed_df = changed_df.drop("_merge", axis=1)
logging.info(
"New Categories found ({}):\n{}".format(
changed_df.shape[0],
@@ -36,8 +41,6 @@ if __name__ == "__main__":
)
)
sys.stdout.write(
f"The files contain invalid or new Categories:\n"
)
sys.stdout.write(f"The files contain invalid or new Categories:\n")
sys.exit(1)
logging.info("Categories check good!")
logging.info("Categories check good!")