diff --git a/09/data_exporter.py b/09/data_exporter.py deleted file mode 100644 index b8b41eb..0000000 --- a/09/data_exporter.py +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/env python3 -""" -Data export utilities for the Cosmic Data Observatory -Exports generated data to JSON, CSV, and Python formats for testing -""" - -import json -import csv -from pathlib import Path -from typing import List, Dict, Any, Union -from data_generator import SpaceStationGenerator, AlienContactGenerator, CrewMissionGenerator, DataConfig - - -class DataExporter: - """Handles data export in multiple formats""" - - def __init__(self, output_dir: str = "generated_data"): - self.output_dir = Path(output_dir) - self.output_dir.mkdir(exist_ok=True) - - def export_to_json(self, data: List[Dict[str, Any]], filename: str) -> Path: - """Export data to JSON format""" - filepath = self.output_dir / f"{filename}.json" - - with open(filepath, 'w', encoding='utf-8') as f: - json.dump(data, f, indent=2, ensure_ascii=False) - - return filepath - - def export_to_csv(self, data: List[Dict[str, Any]], filename: str) -> Path: - """Export flat data to CSV format""" - if not data: - return None - - filepath = self.output_dir / f"{filename}.csv" - - # Handle nested data by flattening - flat_data = [] - for item in data: - flat_item = self._flatten_dict(item) - flat_data.append(flat_item) - - # Get all unique keys for CSV headers - all_keys = set() - for item in flat_data: - all_keys.update(item.keys()) - - with open(filepath, 'w', newline='', encoding='utf-8') as f: - writer = csv.DictWriter(f, fieldnames=sorted(all_keys)) - writer.writeheader() - writer.writerows(flat_data) - - return filepath - - def export_to_python(self, data: List[Dict[str, Any]], filename: str, variable_name: str) -> Path: - """Export data as Python variable for direct import""" - filepath = self.output_dir / f"{filename}.py" - - with open(filepath, 'w', encoding='utf-8') as f: - f.write(f'"""\nGenerated test data for {filename}\n"""\n\n') - # Use repr() to get proper Python syntax instead of JSON - f.write(f'{variable_name} = {self._format_python_data(data)}\n') - - return filepath - - def _format_python_data(self, data: Any, indent: int = 0) -> str: - """Format data as valid Python code with proper True/False/None""" - indent_str = ' ' * indent - next_indent_str = ' ' * (indent + 1) - - if data is None: - return 'None' - elif isinstance(data, bool): - return 'True' if data else 'False' - elif isinstance(data, (int, float)): - return str(data) - elif isinstance(data, str): - # Escape quotes and format as Python string - return repr(data) - elif isinstance(data, list): - if not data: - return '[]' - items = [] - for item in data: - formatted_item = self._format_python_data(item, indent + 1) - items.append(f'{next_indent_str}{formatted_item}') - return '[\n' + ',\n'.join(items) + f'\n{indent_str}]' - elif isinstance(data, dict): - if not data: - return '{}' - items = [] - for key, value in data.items(): - formatted_value = self._format_python_data(value, indent + 1) - items.append(f'{next_indent_str}{repr(key)}: {formatted_value}') - return '{\n' + ',\n'.join(items) + f'\n{indent_str}}}' - else: - return repr(data) - - def _flatten_dict(self, d: Dict[str, Any], parent_key: str = '', sep: str = '_') -> Dict[str, Any]: - """Flatten nested dictionary for CSV export""" - items = [] - - for k, v in d.items(): - new_key = f"{parent_key}{sep}{k}" if parent_key else k - - if isinstance(v, dict): - items.extend(self._flatten_dict(v, new_key, sep=sep).items()) - elif isinstance(v, list) and v and isinstance(v[0], dict): - # Handle list of dictionaries by creating numbered entries - for i, item in enumerate(v): - if isinstance(item, dict): - items.extend(self._flatten_dict(item, f"{new_key}_{i}", sep=sep).items()) - else: - items.append((f"{new_key}_{i}", item)) - elif isinstance(v, list): - # Simple list - join as string - items.append((new_key, ', '.join(map(str, v)))) - else: - items.append((new_key, v)) - - return dict(items) - - -def generate_all_datasets(): - """Generate complete datasets for all exercise types""" - config = DataConfig() - exporter = DataExporter() - - print("๐Ÿ”„ Generating complete datasets...") - - # Generate space station data - station_gen = SpaceStationGenerator(config) - stations = station_gen.generate_station_data(10) - - # Generate alien contact data - contact_gen = AlienContactGenerator(config) - contacts = contact_gen.generate_contact_data(15) - - # Generate mission data - mission_gen = CrewMissionGenerator(config) - missions = mission_gen.generate_mission_data(5) - - # Export in multiple formats - datasets = [ - (stations, "space_stations", "SPACE_STATIONS"), - (contacts, "alien_contacts", "ALIEN_CONTACTS"), - (missions, "space_missions", "SPACE_MISSIONS") - ] - - exported_files = [] - - for data, filename, var_name in datasets: - # Export to JSON - json_file = exporter.export_to_json(data, filename) - exported_files.append(json_file) - - # Export to Python - py_file = exporter.export_to_python(data, filename, var_name) - exported_files.append(py_file) - - # Export to CSV (only for non-nested data) - if filename != "space_missions": # Missions have nested crew data - csv_file = exporter.export_to_csv(data, filename) - if csv_file: - exported_files.append(csv_file) - - print(f"โœ… Generated {len(exported_files)} data files:") - for file_path in exported_files: - print(f" ๐Ÿ“„ {file_path}") - - return exported_files - - -def create_test_scenarios(): - """Create specific test scenarios for validation testing""" - config = DataConfig() - exporter = DataExporter() - - # Invalid space station data - invalid_stations = [ - { - "station_id": "TOOLONG123456", # Too long - "name": "Test Station", - "crew_size": 25, # Too many crew - "power_level": 85.0, - "oxygen_level": 92.0, - "last_maintenance": "2024-01-15T10:30:00", - "is_operational": True - }, - { - "station_id": "TS", # Too short - "name": "", # Empty name - "crew_size": 0, # No crew - "power_level": -10.0, # Negative power - "oxygen_level": 150.0, # Over 100% - "last_maintenance": "2024-01-15T10:30:00", - "is_operational": True - } - ] - - # Invalid alien contacts - invalid_contacts = [ - { - "contact_id": "WRONG_FORMAT", # Doesn't start with AC - "timestamp": "2024-01-15T14:30:00", - "location": "Area 51", - "contact_type": "radio", - "signal_strength": 8.5, - "duration_minutes": 45, - "witness_count": 5, - "message_received": None, # Strong signal without message - "is_verified": False - }, - { - "contact_id": "AC_2024_002", - "timestamp": "2024-01-16T09:15:00", - "location": "Roswell", - "contact_type": "telepathic", - "signal_strength": 6.2, - "duration_minutes": 30, - "witness_count": 1, # Too few witnesses for telepathic - "message_received": None, - "is_verified": False - } - ] - - # Export test scenarios - exporter.export_to_json(invalid_stations, "invalid_stations") - exporter.export_to_json(invalid_contacts, "invalid_contacts") - - print("๐Ÿงช Created validation test scenarios") - - -if __name__ == "__main__": - generate_all_datasets() - create_test_scenarios() - print("\n๐ŸŽฏ All data files ready for testing!") diff --git a/09/data_generator.py b/09/data_generator.py deleted file mode 100644 index 18b577b..0000000 --- a/09/data_generator.py +++ /dev/null @@ -1,302 +0,0 @@ -#!/usr/bin/env python3 -""" -Cosmic Data Observatory - Data Generator -Generates realistic test data for space station monitoring, alien contacts, and crew missions. -""" - -import random -from datetime import datetime, timedelta -from typing import List, Dict, Any -from dataclasses import dataclass - - -@dataclass -class DataConfig: - """Configuration parameters for data generation""" - seed: int = 42 - base_date: datetime = datetime(2024, 1, 1) - date_range_days: int = 365 - - -class SpaceStationGenerator: - """Generates space station monitoring data""" - - STATION_NAMES = [ - "International Space Station", "Lunar Gateway", "Mars Orbital Platform", - "Europa Research Station", "Titan Mining Outpost", "Asteroid Belt Relay", - "Deep Space Observatory", "Solar Wind Monitor", "Quantum Communications Hub" - ] - - STATION_PREFIXES = ["ISS", "LGW", "MOP", "ERS", "TMO", "ABR", "DSO", "SWM", "QCH"] - - def __init__(self, config: DataConfig): - self.config = config - random.seed(config.seed) - - def generate_station_data(self, count: int = 5) -> List[Dict[str, Any]]: - """Generate multiple space station records""" - stations = [] - - for i in range(count): - station_id = f"{random.choice(self.STATION_PREFIXES)}{random.randint(100, 999)}" - name = random.choice(self.STATION_NAMES) - - # Realistic operational parameters - crew_size = random.randint(3, 12) - power_level = round(random.uniform(70.0, 98.5), 1) - oxygen_level = round(random.uniform(85.0, 99.2), 1) - - # Recent maintenance date - days_ago = random.randint(1, 180) - maintenance_date = self.config.base_date - timedelta(days=days_ago) - - # Operational status based on system health - is_operational = power_level > 75.0 and oxygen_level > 90.0 - - # Optional maintenance notes - notes = None - if not is_operational: - notes = "System diagnostics required" - elif random.random() < 0.3: - notes = "All systems nominal" - - stations.append({ - "station_id": station_id, - "name": name, - "crew_size": crew_size, - "power_level": power_level, - "oxygen_level": oxygen_level, - "last_maintenance": maintenance_date.isoformat(), - "is_operational": is_operational, - "notes": notes - }) - - return stations - - -class AlienContactGenerator: - """Generates alien contact report data""" - - LOCATIONS = [ - "Area 51, Nevada", "Roswell, New Mexico", "SETI Institute, California", - "Arecibo Observatory, Puerto Rico", "Atacama Desert, Chile", - "Antarctic Research Station", "International Space Station", - "Mauna Kea Observatory, Hawaii", "Very Large Array, New Mexico" - ] - - CONTACT_TYPES = ["radio", "visual", "physical", "telepathic"] - - MESSAGES = [ - "Greetings from Zeta Reticuli", - "Mathematical sequence detected: prime numbers", - "Coordinates to star system received", - "Warning about solar flare activity", - "Request for peaceful contact", - "Unknown language pattern identified" - ] - - def __init__(self, config: DataConfig): - self.config = config - random.seed(config.seed + 1) - - def generate_contact_data(self, count: int = 8) -> List[Dict[str, Any]]: - """Generate multiple alien contact records""" - contacts = [] - - for i in range(count): - contact_id = f"AC_{self.config.base_date.year}_{str(i+1).zfill(3)}" - - # Random contact timing within date range - days_offset = random.randint(0, self.config.date_range_days) - contact_time = self.config.base_date + timedelta(days=days_offset) - - location = random.choice(self.LOCATIONS) - contact_type = random.choice(self.CONTACT_TYPES) - - # Signal characteristics - signal_strength = round(random.uniform(1.0, 10.0), 1) - duration = random.randint(5, 240) # 5 minutes to 4 hours - witnesses = random.randint(1, 15) - - # Message content for strong signals - message = None - if signal_strength > 6.0 and random.random() < 0.7: - message = random.choice(self.MESSAGES) - - # Verification status - is_verified = False - if contact_type == "physical": - is_verified = True # Physical contacts must be verified - elif contact_type == "radio" and signal_strength > 8.0: - is_verified = random.random() < 0.8 - - # Adjust witnesses for telepathic contacts - if contact_type == "telepathic" and witnesses < 3: - witnesses = random.randint(3, 8) - - contacts.append({ - "contact_id": contact_id, - "timestamp": contact_time.isoformat(), - "location": location, - "contact_type": contact_type, - "signal_strength": signal_strength, - "duration_minutes": duration, - "witness_count": witnesses, - "message_received": message, - "is_verified": is_verified - }) - - return contacts - - -class CrewMissionGenerator: - """Generates space crew and mission data""" - - FIRST_NAMES = [ - "Sarah", "John", "Alice", "Michael", "Emma", "David", "Lisa", "Robert", - "Maria", "James", "Anna", "William", "Elena", "Thomas", "Sofia", "Daniel" - ] - - LAST_NAMES = [ - "Connor", "Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", - "Miller", "Davis", "Rodriguez", "Martinez", "Hernandez", "Lopez", "Gonzalez" - ] - - SPECIALIZATIONS = [ - "Mission Command", "Navigation", "Engineering", "Life Support", - "Communications", "Medical Officer", "Pilot", "Science Officer", - "Maintenance", "Security", "Research", "Systems Analysis" - ] - - RANKS = ["cadet", "officer", "lieutenant", "captain", "commander"] - - DESTINATIONS = [ - "Mars", "Moon", "Europa", "Titan", "Asteroid Belt", - "Jupiter Orbit", "Saturn Rings", "Deep Space", "Solar Observatory" - ] - - def __init__(self, config: DataConfig): - self.config = config - random.seed(config.seed + 2) - - def generate_crew_member(self, member_id: str) -> Dict[str, Any]: - """Generate a single crew member""" - name = f"{random.choice(self.FIRST_NAMES)} {random.choice(self.LAST_NAMES)}" - rank = random.choice(self.RANKS) - age = random.randint(25, 55) - specialization = random.choice(self.SPECIALIZATIONS) - - # Experience correlates with age and rank - base_experience = max(0, age - 22) - rank_bonus = {"cadet": 0, "officer": 2, "lieutenant": 5, "captain": 8, "commander": 12} - years_experience = min(base_experience + rank_bonus[rank] + random.randint(-2, 3), 30) - - return { - "member_id": member_id, - "name": name, - "rank": rank, - "age": age, - "specialization": specialization, - "years_experience": max(0, years_experience), - "is_active": True - } - - def generate_mission_data(self, count: int = 3) -> List[Dict[str, Any]]: - """Generate complete mission records with crews""" - missions = [] - - for i in range(count): - mission_id = f"M{self.config.base_date.year}_{random.choice(['MARS', 'LUNA', 'EUROPA', 'TITAN'])}" - destination = random.choice(self.DESTINATIONS) - mission_name = f"{destination} {'Colony' if random.random() < 0.5 else 'Research'} Mission" - - # Mission timing - launch_offset = random.randint(30, 300) - launch_date = self.config.base_date + timedelta(days=launch_offset) - - # Mission parameters - duration = random.randint(90, 1200) # 3 months to 3+ years - budget = round(random.uniform(500.0, 5000.0), 1) - - # Generate crew (3-8 members) - crew_size = random.randint(3, 8) - crew = [] - - # Ensure at least one high-ranking officer - has_commander = False - for j in range(crew_size): - member_id = f"CM{str(i*10 + j + 1).zfill(3)}" - member = self.generate_crew_member(member_id) - - # First member has higher chance of being high-ranking - if j == 0 and not has_commander: - member["rank"] = random.choice(["captain", "commander"]) - has_commander = True - - crew.append(member) - - # For long missions, ensure experienced crew - if duration > 365: - experienced_needed = len(crew) // 2 - experienced_count = sum(1 for member in crew if member["years_experience"] >= 5) - - if experienced_count < experienced_needed: - # Boost experience for some crew members - for member in crew[:experienced_needed]: - if member["years_experience"] < 5: - member["years_experience"] = random.randint(5, 15) - - missions.append({ - "mission_id": mission_id, - "mission_name": mission_name, - "destination": destination, - "launch_date": launch_date.isoformat(), - "duration_days": duration, - "crew": crew, - "mission_status": "planned", - "budget_millions": budget - }) - - return missions - - -def main(): - """Generate sample data for all exercise types""" - config = DataConfig() - - print("๐Ÿš€ Cosmic Data Observatory - Sample Data Generator") - print("=" * 60) - - # Generate space station data - station_gen = SpaceStationGenerator(config) - stations = station_gen.generate_station_data(5) - - print(f"\n๐Ÿ“ก Generated {len(stations)} space stations:") - for station in stations: - status = "โœ… Operational" if station["is_operational"] else "โš ๏ธ Maintenance" - print(f" {station['station_id']}: {station['name']} - {status}") - - # Generate alien contact data - contact_gen = AlienContactGenerator(config) - contacts = contact_gen.generate_contact_data(6) - - print(f"\n๐Ÿ‘ฝ Generated {len(contacts)} alien contacts:") - for contact in contacts: - verified = "โœ… Verified" if contact["is_verified"] else "โ“ Unverified" - print(f" {contact['contact_id']}: {contact['contact_type']} at {contact['location']} - {verified}") - - # Generate mission data - mission_gen = CrewMissionGenerator(config) - missions = mission_gen.generate_mission_data(3) - - print(f"\n๐Ÿš€ Generated {len(missions)} space missions:") - for mission in missions: - print(f" {mission['mission_id']}: {mission['mission_name']}") - print(f" Crew: {len(mission['crew'])} members, Duration: {mission['duration_days']} days") - - print("\n" + "=" * 60) - print("Data generation complete! Use these generators in your exercises.") - - -if __name__ == "__main__": - main() diff --git a/09/ex0/space_station.py b/09/ex0/space_station.py index 8d1ef44..ccd88e5 100644 --- a/09/ex0/space_station.py +++ b/09/ex0/space_station.py @@ -1,109 +1,6 @@ import datetime -from typing import Optional from pydantic import BaseModel, Field, ValidationError - -SPACE_STATIONS = [ - { - "station_id": "LGW125", - "name": "Titan Mining Outpost", - "crew_size": 6, - "power_level": 76.4, - "oxygen_level": 95.5, - "last_maintenance": "2023-07-11T00:00:00", - "is_operational": True, - "notes": None, - }, - { - "station_id": "QCH189", - "name": "Deep Space Observatory", - "crew_size": 3, - "power_level": 70.8, - "oxygen_level": 88.1, - "last_maintenance": "2023-08-24T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "ISS674", - "name": "Europa Research Station", - "crew_size": 11, - "power_level": 82.0, - "oxygen_level": 91.4, - "last_maintenance": "2023-10-21T00:00:00", - "is_operational": True, - "notes": None, - }, - { - "station_id": "ISS877", - "name": "Mars Orbital Platform", - "crew_size": 9, - "power_level": 79.7, - "oxygen_level": 87.2, - "last_maintenance": "2023-10-06T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "LGW194", - "name": "Deep Space Observatory", - "crew_size": 4, - "power_level": 80.2, - "oxygen_level": 89.9, - "last_maintenance": "2023-10-25T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "ISS847", - "name": "Solar Wind Monitor", - "crew_size": 11, - "power_level": 73.6, - "oxygen_level": 98.1, - "last_maintenance": "2023-12-11T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "QCH400", - "name": "Asteroid Belt Relay", - "crew_size": 12, - "power_level": 75.5, - "oxygen_level": 86.0, - "last_maintenance": "2023-07-15T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "ERS891", - "name": "Titan Mining Outpost", - "crew_size": 4, - "power_level": 94.4, - "oxygen_level": 97.3, - "last_maintenance": "2023-09-25T00:00:00", - "is_operational": True, - "notes": "All systems nominal", - }, - { - "station_id": "ABR266", - "name": "Asteroid Belt Relay", - "crew_size": 8, - "power_level": 76.0, - "oxygen_level": 88.8, - "last_maintenance": "2023-07-10T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, - { - "station_id": "LGW723", - "name": "Mars Orbital Platform", - "crew_size": 11, - "power_level": 90.8, - "oxygen_level": 87.3, - "last_maintenance": "2023-09-25T00:00:00", - "is_operational": False, - "notes": "System diagnostics required", - }, -] +from json import load class SpaceStation(BaseModel): @@ -119,73 +16,46 @@ class SpaceStation(BaseModel): def main() -> None: try: - valid_station = { - "station_id": "ISS001", - "name": "International Space Station", - "crew_size": 6, - "power_level": 85.5, - "oxygen_level": 92.3, - "last_maintenance": "2023-09-25T00:00:00", - } + with open("../generated_data/space_stations.json") as valids, open( + "../generated_data/invalid_stations.json" + ) as invalids: + print("\ninvalid stations:\n") + data = load(invalids) + for station in data: + try: + print("========================================") + ss = SpaceStation(**station) + print("Valid station created") + print( + f"ID: {ss.station_id}\n" + f"Name {ss.name}\n" + f"Crew: {ss.crew_size} people\n" + f"Power: {ss.power_level}%\n" + f"Oxygen: {ss.oxygen_level}%\n" + f"Status: {'operational' if ss.is_operational else 'not operational'}\n" + f"Note: {ss.notes}\n" + ) + except ValidationError as err: + print(err.errors()[0]["msg"]) - invalid_station = { - "station_id": "ISS001", - "name": "International Space Station", - "crew_size": 26, - "power_level": 85.5, - "oxygen_level": 92.3, - "last_maintenance": "2023-09-25T00:00:00", - } - - try: - print("\nValid station:n\n") - ss = SpaceStation(**valid_station) - print("Valid station created") - print( - f"ID: {ss.station_id}\n" - f"Name {ss.name}\n" - f"Crew: {ss.crew_size} people\n" - f"Power: {ss.power_level}%\n" - f"Oxygen: {ss.oxygen_level}%\n" - f"Status: {'operational' if ss.is_operational else 'not operational'}\n" - f"Note: {ss.notes}\n" - ) - except ValidationError as err: - print(err) - - try: - print("\nInvalid station:\n") - ss = SpaceStation(**invalid_station) - print("Valid station created") - print( - f"ID: {ss.station_id}\n" - f"Name {ss.name}\n" - f"Crew: {ss.crew_size} people\n" - f"Power: {ss.power_level}%\n" - f"Oxygen: {ss.oxygen_level}%\n" - f"Status: {'operational' if ss.is_operational else 'not operational'}\n" - f"Note: {ss.notes}\n" - ) - except ValidationError as err: - print(err) - - print("\nBatch stations:\n") - for station in SPACE_STATIONS: - try: - ss = SpaceStation(**station) - print("========================================") - print("Valid station created") - print( - f"ID: {ss.station_id}\n" - f"Name {ss.name}\n" - f"Crew: {ss.crew_size} people\n" - f"Power: {ss.power_level}%\n" - f"Oxygen: {ss.oxygen_level}%\n" - f"Status: {'operational' if ss.is_operational else 'not operational'}\n" - f"Note: {ss.notes}\n" - ) - except ValidationError as e: - print(e.errors()) + print("\nvalid stations:\n") + data = load(valids) + for station in data: + try: + print("========================================") + ss = SpaceStation(**station) + print("Valid station created") + print( + f"ID: {ss.station_id}\n" + f"Name {ss.name}\n" + f"Crew: {ss.crew_size} people\n" + f"Power: {ss.power_level}%\n" + f"Oxygen: {ss.oxygen_level}%\n" + f"Status: {'operational' if ss.is_operational else 'not operational'}\n" + f"Note: {ss.notes}\n" + ) + except ValidationError as err: + print(err.errors()[0]["msg"]) except Exception as err: print(err) diff --git a/09/ex1/alien_contact.py b/09/ex1/alien_contact.py index a852830..225c33b 100644 --- a/09/ex1/alien_contact.py +++ b/09/ex1/alien_contact.py @@ -1,7 +1,7 @@ from typing_extensions import Self import datetime from enum import Enum -from pydantic import BaseModel, Field, model_validator +from pydantic import BaseModel, Field, ValidationError, model_validator import json @@ -48,13 +48,16 @@ class AlienContact(BaseModel): def main() -> None: try: - with open("../generated_data/alien_contacts.json") as file: - data = json.load(file) + with open("../generated_data/alien_contacts.json") as valids, open( + "../generated_data/invalid_contacts.json" + ) as invalids: + print("=== invalids ===") + data = json.load(invalids) for contact in data: try: + print("======================================\n") ac = AlienContact(**contact) print( - f"======================================\n" f"Valid contact report:\n" f"ID: {ac.contact_id}\n" f"Type: {ac.contact_type}\n" @@ -65,8 +68,28 @@ def main() -> None: f"Message: {ac.message_received}\n" f"Is verified: {ac.is_verified}\n" ) - except Exception as err: - print(err) + except ValidationError as err: + print(err.errors()[0]["msg"]) + + print("=== valids ===") + data = json.load(valids) + for contact in data: + try: + print("======================================\n") + ac = AlienContact(**contact) + print( + f"Valid contact report:\n" + f"ID: {ac.contact_id}\n" + f"Type: {ac.contact_type}\n" + f"Location: {ac.location}\n" + f"Signal: {ac.signal_strength:.1f}/10\n" + f"Duration: {ac.duration_minutes} minutes\n" + f"Witness: {ac.witness_count}\n" + f"Message: {ac.message_received}\n" + f"Is verified: {ac.is_verified}\n" + ) + except ValidationError as err: + print(err.errors()[0]["msg"]) except Exception as err: print(err) diff --git a/09/ex2/space_crew.py b/09/ex2/space_crew.py index 8351a8c..46ef305 100644 --- a/09/ex2/space_crew.py +++ b/09/ex2/space_crew.py @@ -1,6 +1,6 @@ from enum import Enum from typing_extensions import Self -from pydantic import BaseModel, Field, model_validator +from pydantic import BaseModel, Field, ValidationError, model_validator from datetime import datetime from json import load @@ -87,8 +87,8 @@ def main() -> None: f"- {member.name} ({member.rank}) - " f"{member.specialization}" ) - except Exception as err: - print(err) + except ValidationError as err: + print(err.errors()[0]["msg"]) except Exception as err: print(err) diff --git a/09/generated_data/alien_contacts.csv b/09/generated_data/alien_contacts.csv deleted file mode 100644 index fd2274d..0000000 --- a/09/generated_data/alien_contacts.csv +++ /dev/null @@ -1,16 +0,0 @@ -contact_id,contact_type,duration_minutes,is_verified,location,message_received,signal_strength,timestamp,witness_count -AC_2024_001,visual,99,False,"Atacama Desert, Chile",Greetings from Zeta Reticuli,9.6,2024-01-20T00:00:00,11 -AC_2024_002,radio,152,False,"Mauna Kea Observatory, Hawaii",,5.6,2024-08-20T00:00:00,6 -AC_2024_003,telepathic,19,False,"Very Large Array, New Mexico",,4.5,2024-11-15T00:00:00,14 -AC_2024_004,telepathic,46,False,"Roswell, New Mexico",,2.4,2024-02-24T00:00:00,9 -AC_2024_005,telepathic,134,False,"SETI Institute, California",Warning about solar flare activity,6.4,2024-09-10T00:00:00,5 -AC_2024_006,radio,20,False,"Area 51, Nevada",,2.7,2024-02-02T00:00:00,14 -AC_2024_007,physical,138,True,"Atacama Desert, Chile",Request for peaceful contact,9.0,2024-03-25T00:00:00,10 -AC_2024_008,radio,122,True,"Area 51, Nevada",Unknown language pattern identified,8.6,2024-11-30T00:00:00,13 -AC_2024_009,visual,25,False,"Mauna Kea Observatory, Hawaii",,2.1,2024-09-27T00:00:00,13 -AC_2024_010,physical,52,True,"Area 51, Nevada",,4.3,2024-06-12T00:00:00,11 -AC_2024_011,radio,235,False,"Roswell, New Mexico",,3.7,2024-11-05T00:00:00,13 -AC_2024_012,radio,111,False,International Space Station,,5.3,2024-07-04T00:00:00,10 -AC_2024_013,visual,228,False,Antarctic Research Station,,6.8,2024-02-12T00:00:00,11 -AC_2024_014,radio,113,False,"Atacama Desert, Chile",Mathematical sequence detected: prime numbers,7.2,2024-10-20T00:00:00,8 -AC_2024_015,radio,9,False,"Roswell, New Mexico",,2.1,2024-01-02T00:00:00,13 diff --git a/09/generated_data/alien_contacts.json b/09/generated_data/alien_contacts.json deleted file mode 100644 index e4e8b7e..0000000 --- a/09/generated_data/alien_contacts.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "contact_id": "AC_2024_001", - "timestamp": "2024-01-20T00:00:00", - "location": "Atacama Desert, Chile", - "contact_type": "visual", - "signal_strength": 9.6, - "duration_minutes": 99, - "witness_count": 11, - "message_received": "Greetings from Zeta Reticuli", - "is_verified": false - }, - { - "contact_id": "AC_2024_002", - "timestamp": "2024-08-20T00:00:00", - "location": "Mauna Kea Observatory, Hawaii", - "contact_type": "radio", - "signal_strength": 5.6, - "duration_minutes": 152, - "witness_count": 6, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_003", - "timestamp": "2024-11-15T00:00:00", - "location": "Very Large Array, New Mexico", - "contact_type": "telepathic", - "signal_strength": 4.5, - "duration_minutes": 19, - "witness_count": 14, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_004", - "timestamp": "2024-02-24T00:00:00", - "location": "Roswell, New Mexico", - "contact_type": "telepathic", - "signal_strength": 2.4, - "duration_minutes": 46, - "witness_count": 9, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_005", - "timestamp": "2024-09-10T00:00:00", - "location": "SETI Institute, California", - "contact_type": "telepathic", - "signal_strength": 6.4, - "duration_minutes": 134, - "witness_count": 5, - "message_received": "Warning about solar flare activity", - "is_verified": false - }, - { - "contact_id": "AC_2024_006", - "timestamp": "2024-02-02T00:00:00", - "location": "Area 51, Nevada", - "contact_type": "radio", - "signal_strength": 2.7, - "duration_minutes": 20, - "witness_count": 14, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_007", - "timestamp": "2024-03-25T00:00:00", - "location": "Atacama Desert, Chile", - "contact_type": "physical", - "signal_strength": 9.0, - "duration_minutes": 138, - "witness_count": 10, - "message_received": "Request for peaceful contact", - "is_verified": true - }, - { - "contact_id": "AC_2024_008", - "timestamp": "2024-11-30T00:00:00", - "location": "Area 51, Nevada", - "contact_type": "radio", - "signal_strength": 8.6, - "duration_minutes": 122, - "witness_count": 13, - "message_received": "Unknown language pattern identified", - "is_verified": true - }, - { - "contact_id": "AC_2024_009", - "timestamp": "2024-09-27T00:00:00", - "location": "Mauna Kea Observatory, Hawaii", - "contact_type": "visual", - "signal_strength": 2.1, - "duration_minutes": 25, - "witness_count": 13, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_010", - "timestamp": "2024-06-12T00:00:00", - "location": "Area 51, Nevada", - "contact_type": "physical", - "signal_strength": 4.3, - "duration_minutes": 52, - "witness_count": 11, - "message_received": null, - "is_verified": true - }, - { - "contact_id": "AC_2024_011", - "timestamp": "2024-11-05T00:00:00", - "location": "Roswell, New Mexico", - "contact_type": "radio", - "signal_strength": 3.7, - "duration_minutes": 235, - "witness_count": 13, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_012", - "timestamp": "2024-07-04T00:00:00", - "location": "International Space Station", - "contact_type": "radio", - "signal_strength": 5.3, - "duration_minutes": 111, - "witness_count": 10, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_013", - "timestamp": "2024-02-12T00:00:00", - "location": "Antarctic Research Station", - "contact_type": "visual", - "signal_strength": 6.8, - "duration_minutes": 228, - "witness_count": 11, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_014", - "timestamp": "2024-10-20T00:00:00", - "location": "Atacama Desert, Chile", - "contact_type": "radio", - "signal_strength": 7.2, - "duration_minutes": 113, - "witness_count": 8, - "message_received": "Mathematical sequence detected: prime numbers", - "is_verified": false - }, - { - "contact_id": "AC_2024_015", - "timestamp": "2024-01-02T00:00:00", - "location": "Roswell, New Mexico", - "contact_type": "radio", - "signal_strength": 2.1, - "duration_minutes": 9, - "witness_count": 13, - "message_received": null, - "is_verified": false - } -] \ No newline at end of file diff --git a/09/generated_data/alien_contacts.py b/09/generated_data/alien_contacts.py deleted file mode 100644 index 5dbea1a..0000000 --- a/09/generated_data/alien_contacts.py +++ /dev/null @@ -1,171 +0,0 @@ -""" -Generated test data for alien_contacts -""" - -ALIEN_CONTACTS = [ - { - 'contact_id': 'AC_2024_001', - 'timestamp': '2024-01-20T00:00:00', - 'location': 'Atacama Desert, Chile', - 'contact_type': 'visual', - 'signal_strength': 9.6, - 'duration_minutes': 99, - 'witness_count': 11, - 'message_received': 'Greetings from Zeta Reticuli', - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_002', - 'timestamp': '2024-08-20T00:00:00', - 'location': 'Mauna Kea Observatory, Hawaii', - 'contact_type': 'radio', - 'signal_strength': 5.6, - 'duration_minutes': 152, - 'witness_count': 6, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_003', - 'timestamp': '2024-11-15T00:00:00', - 'location': 'Very Large Array, New Mexico', - 'contact_type': 'telepathic', - 'signal_strength': 4.5, - 'duration_minutes': 19, - 'witness_count': 14, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_004', - 'timestamp': '2024-02-24T00:00:00', - 'location': 'Roswell, New Mexico', - 'contact_type': 'telepathic', - 'signal_strength': 2.4, - 'duration_minutes': 46, - 'witness_count': 9, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_005', - 'timestamp': '2024-09-10T00:00:00', - 'location': 'SETI Institute, California', - 'contact_type': 'telepathic', - 'signal_strength': 6.4, - 'duration_minutes': 134, - 'witness_count': 5, - 'message_received': 'Warning about solar flare activity', - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_006', - 'timestamp': '2024-02-02T00:00:00', - 'location': 'Area 51, Nevada', - 'contact_type': 'radio', - 'signal_strength': 2.7, - 'duration_minutes': 20, - 'witness_count': 14, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_007', - 'timestamp': '2024-03-25T00:00:00', - 'location': 'Atacama Desert, Chile', - 'contact_type': 'physical', - 'signal_strength': 9.0, - 'duration_minutes': 138, - 'witness_count': 10, - 'message_received': 'Request for peaceful contact', - 'is_verified': True - }, - { - 'contact_id': 'AC_2024_008', - 'timestamp': '2024-11-30T00:00:00', - 'location': 'Area 51, Nevada', - 'contact_type': 'radio', - 'signal_strength': 8.6, - 'duration_minutes': 122, - 'witness_count': 13, - 'message_received': 'Unknown language pattern identified', - 'is_verified': True - }, - { - 'contact_id': 'AC_2024_009', - 'timestamp': '2024-09-27T00:00:00', - 'location': 'Mauna Kea Observatory, Hawaii', - 'contact_type': 'visual', - 'signal_strength': 2.1, - 'duration_minutes': 25, - 'witness_count': 13, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_010', - 'timestamp': '2024-06-12T00:00:00', - 'location': 'Area 51, Nevada', - 'contact_type': 'physical', - 'signal_strength': 4.3, - 'duration_minutes': 52, - 'witness_count': 11, - 'message_received': None, - 'is_verified': True - }, - { - 'contact_id': 'AC_2024_011', - 'timestamp': '2024-11-05T00:00:00', - 'location': 'Roswell, New Mexico', - 'contact_type': 'radio', - 'signal_strength': 3.7, - 'duration_minutes': 235, - 'witness_count': 13, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_012', - 'timestamp': '2024-07-04T00:00:00', - 'location': 'International Space Station', - 'contact_type': 'radio', - 'signal_strength': 5.3, - 'duration_minutes': 111, - 'witness_count': 10, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_013', - 'timestamp': '2024-02-12T00:00:00', - 'location': 'Antarctic Research Station', - 'contact_type': 'visual', - 'signal_strength': 6.8, - 'duration_minutes': 228, - 'witness_count': 11, - 'message_received': None, - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_014', - 'timestamp': '2024-10-20T00:00:00', - 'location': 'Atacama Desert, Chile', - 'contact_type': 'radio', - 'signal_strength': 7.2, - 'duration_minutes': 113, - 'witness_count': 8, - 'message_received': 'Mathematical sequence detected: prime numbers', - 'is_verified': False - }, - { - 'contact_id': 'AC_2024_015', - 'timestamp': '2024-01-02T00:00:00', - 'location': 'Roswell, New Mexico', - 'contact_type': 'radio', - 'signal_strength': 2.1, - 'duration_minutes': 9, - 'witness_count': 13, - 'message_received': None, - 'is_verified': False - } -] diff --git a/09/generated_data/invalid_contacts.json b/09/generated_data/invalid_contacts.json deleted file mode 100644 index 468fb32..0000000 --- a/09/generated_data/invalid_contacts.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "contact_id": "WRONG_FORMAT", - "timestamp": "2024-01-15T14:30:00", - "location": "Area 51", - "contact_type": "radio", - "signal_strength": 8.5, - "duration_minutes": 45, - "witness_count": 5, - "message_received": null, - "is_verified": false - }, - { - "contact_id": "AC_2024_002", - "timestamp": "2024-01-16T09:15:00", - "location": "Roswell", - "contact_type": "telepathic", - "signal_strength": 6.2, - "duration_minutes": 30, - "witness_count": 1, - "message_received": null, - "is_verified": false - } -] \ No newline at end of file diff --git a/09/generated_data/invalid_stations.json b/09/generated_data/invalid_stations.json deleted file mode 100644 index a2dd0f1..0000000 --- a/09/generated_data/invalid_stations.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "station_id": "TOOLONG123456", - "name": "Test Station", - "crew_size": 25, - "power_level": 85.0, - "oxygen_level": 92.0, - "last_maintenance": "2024-01-15T10:30:00", - "is_operational": true - }, - { - "station_id": "TS", - "name": "", - "crew_size": 0, - "power_level": -10.0, - "oxygen_level": 150.0, - "last_maintenance": "2024-01-15T10:30:00", - "is_operational": true - } -] \ No newline at end of file diff --git a/09/generated_data/space_missions.json b/09/generated_data/space_missions.json deleted file mode 100644 index bba2bfa..0000000 --- a/09/generated_data/space_missions.json +++ /dev/null @@ -1,309 +0,0 @@ -[ - { - "mission_id": "M2024_TITAN", - "mission_name": "Solar Observatory Research Mission", - "destination": "Solar Observatory", - "launch_date": "2024-03-30T00:00:00", - "duration_days": 451, - "crew": [ - { - "member_id": "CM001", - "name": "Sarah Williams", - "rank": "captain", - "age": 43, - "specialization": "Mission Command", - "years_experience": 19, - "is_active": true - }, - { - "member_id": "CM002", - "name": "James Hernandez", - "rank": "captain", - "age": 43, - "specialization": "Pilot", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM003", - "name": "Anna Jones", - "rank": "cadet", - "age": 35, - "specialization": "Communications", - "years_experience": 15, - "is_active": true - }, - { - "member_id": "CM004", - "name": "David Smith", - "rank": "commander", - "age": 27, - "specialization": "Security", - "years_experience": 15, - "is_active": true - }, - { - "member_id": "CM005", - "name": "Maria Jones", - "rank": "cadet", - "age": 55, - "specialization": "Research", - "years_experience": 30, - "is_active": true - } - ], - "mission_status": "planned", - "budget_millions": 2208.1 - }, - { - "mission_id": "M2024_MARS", - "mission_name": "Jupiter Orbit Colony Mission", - "destination": "Jupiter Orbit", - "launch_date": "2024-10-01T00:00:00", - "duration_days": 1065, - "crew": [ - { - "member_id": "CM011", - "name": "Emma Brown", - "rank": "commander", - "age": 49, - "specialization": "Mission Command", - "years_experience": 27, - "is_active": true - }, - { - "member_id": "CM012", - "name": "John Hernandez", - "rank": "lieutenant", - "age": 36, - "specialization": "Science Officer", - "years_experience": 22, - "is_active": true - }, - { - "member_id": "CM013", - "name": "Sofia Rodriguez", - "rank": "commander", - "age": 29, - "specialization": "Life Support", - "years_experience": 20, - "is_active": true - }, - { - "member_id": "CM014", - "name": "Sofia Lopez", - "rank": "lieutenant", - "age": 44, - "specialization": "Systems Analysis", - "years_experience": 25, - "is_active": true - } - ], - "mission_status": "planned", - "budget_millions": 4626.0 - }, - { - "mission_id": "M2024_EUROPA", - "mission_name": "Europa Colony Mission", - "destination": "Europa", - "launch_date": "2024-02-07T00:00:00", - "duration_days": 666, - "crew": [ - { - "member_id": "CM021", - "name": "Lisa Garcia", - "rank": "captain", - "age": 36, - "specialization": "Medical Officer", - "years_experience": 12, - "is_active": true - }, - { - "member_id": "CM022", - "name": "John Garcia", - "rank": "cadet", - "age": 46, - "specialization": "Security", - "years_experience": 25, - "is_active": true - }, - { - "member_id": "CM023", - "name": "Michael Johnson", - "rank": "officer", - "age": 54, - "specialization": "Research", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM024", - "name": "Sarah Rodriguez", - "rank": "lieutenant", - "age": 54, - "specialization": "Research", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM025", - "name": "Maria Smith", - "rank": "cadet", - "age": 38, - "specialization": "Communications", - "years_experience": 15, - "is_active": true - } - ], - "mission_status": "planned", - "budget_millions": 4976.0 - }, - { - "mission_id": "M2024_LUNA", - "mission_name": "Mars Colony Mission", - "destination": "Mars", - "launch_date": "2024-06-13T00:00:00", - "duration_days": 222, - "crew": [ - { - "member_id": "CM031", - "name": "Anna Davis", - "rank": "commander", - "age": 27, - "specialization": "Communications", - "years_experience": 14, - "is_active": true - }, - { - "member_id": "CM032", - "name": "Elena Garcia", - "rank": "lieutenant", - "age": 42, - "specialization": "Science Officer", - "years_experience": 23, - "is_active": true - }, - { - "member_id": "CM033", - "name": "Anna Brown", - "rank": "officer", - "age": 55, - "specialization": "Engineering", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM034", - "name": "Emma Smith", - "rank": "captain", - "age": 37, - "specialization": "Research", - "years_experience": 23, - "is_active": true - }, - { - "member_id": "CM035", - "name": "Sofia Smith", - "rank": "lieutenant", - "age": 53, - "specialization": "Security", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM036", - "name": "Maria Hernandez", - "rank": "commander", - "age": 41, - "specialization": "Medical Officer", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM037", - "name": "John Hernandez", - "rank": "officer", - "age": 42, - "specialization": "Science Officer", - "years_experience": 20, - "is_active": true - } - ], - "mission_status": "planned", - "budget_millions": 4984.6 - }, - { - "mission_id": "M2024_EUROPA", - "mission_name": "Saturn Rings Research Mission", - "destination": "Saturn Rings", - "launch_date": "2024-09-18T00:00:00", - "duration_days": 602, - "crew": [ - { - "member_id": "CM041", - "name": "William Davis", - "rank": "captain", - "age": 35, - "specialization": "Medical Officer", - "years_experience": 14, - "is_active": true - }, - { - "member_id": "CM042", - "name": "Sarah Smith", - "rank": "captain", - "age": 55, - "specialization": "Research", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM043", - "name": "Elena Garcia", - "rank": "commander", - "age": 55, - "specialization": "Research", - "years_experience": 30, - "is_active": true - }, - { - "member_id": "CM044", - "name": "Sofia Williams", - "rank": "officer", - "age": 30, - "specialization": "Systems Analysis", - "years_experience": 9, - "is_active": true - }, - { - "member_id": "CM045", - "name": "Sarah Jones", - "rank": "lieutenant", - "age": 25, - "specialization": "Maintenance", - "years_experience": 11, - "is_active": true - }, - { - "member_id": "CM046", - "name": "Lisa Rodriguez", - "rank": "officer", - "age": 30, - "specialization": "Life Support", - "years_experience": 12, - "is_active": true - }, - { - "member_id": "CM047", - "name": "Sarah Smith", - "rank": "cadet", - "age": 28, - "specialization": "Pilot", - "years_experience": 8, - "is_active": true - } - ], - "mission_status": "planned", - "budget_millions": 1092.6 - } -] \ No newline at end of file diff --git a/09/generated_data/space_missions.py b/09/generated_data/space_missions.py deleted file mode 100644 index ec898ce..0000000 --- a/09/generated_data/space_missions.py +++ /dev/null @@ -1,313 +0,0 @@ -""" -Generated test data for space_missions -""" - -SPACE_MISSIONS = [ - { - 'mission_id': 'M2024_TITAN', - 'mission_name': 'Solar Observatory Research Mission', - 'destination': 'Solar Observatory', - 'launch_date': '2024-03-30T00:00:00', - 'duration_days': 451, - 'crew': [ - { - 'member_id': 'CM001', - 'name': 'Sarah Williams', - 'rank': 'captain', - 'age': 43, - 'specialization': 'Mission Command', - 'years_experience': 19, - 'is_active': True - }, - { - 'member_id': 'CM002', - 'name': 'James Hernandez', - 'rank': 'captain', - 'age': 43, - 'specialization': 'Pilot', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM003', - 'name': 'Anna Jones', - 'rank': 'cadet', - 'age': 35, - 'specialization': 'Communications', - 'years_experience': 15, - 'is_active': True - }, - { - 'member_id': 'CM004', - 'name': 'David Smith', - 'rank': 'commander', - 'age': 27, - 'specialization': 'Security', - 'years_experience': 15, - 'is_active': True - }, - { - 'member_id': 'CM005', - 'name': 'Maria Jones', - 'rank': 'cadet', - 'age': 55, - 'specialization': 'Research', - 'years_experience': 30, - 'is_active': True - } - ], - 'mission_status': 'planned', - 'budget_millions': 2208.1 - }, - { - 'mission_id': 'M2024_MARS', - 'mission_name': 'Jupiter Orbit Colony Mission', - 'destination': 'Jupiter Orbit', - 'launch_date': '2024-10-01T00:00:00', - 'duration_days': 1065, - 'crew': [ - { - 'member_id': 'CM011', - 'name': 'Emma Brown', - 'rank': 'commander', - 'age': 49, - 'specialization': 'Mission Command', - 'years_experience': 27, - 'is_active': True - }, - { - 'member_id': 'CM012', - 'name': 'John Hernandez', - 'rank': 'lieutenant', - 'age': 36, - 'specialization': 'Science Officer', - 'years_experience': 22, - 'is_active': True - }, - { - 'member_id': 'CM013', - 'name': 'Sofia Rodriguez', - 'rank': 'commander', - 'age': 29, - 'specialization': 'Life Support', - 'years_experience': 20, - 'is_active': True - }, - { - 'member_id': 'CM014', - 'name': 'Sofia Lopez', - 'rank': 'lieutenant', - 'age': 44, - 'specialization': 'Systems Analysis', - 'years_experience': 25, - 'is_active': True - } - ], - 'mission_status': 'planned', - 'budget_millions': 4626.0 - }, - { - 'mission_id': 'M2024_EUROPA', - 'mission_name': 'Europa Colony Mission', - 'destination': 'Europa', - 'launch_date': '2024-02-07T00:00:00', - 'duration_days': 666, - 'crew': [ - { - 'member_id': 'CM021', - 'name': 'Lisa Garcia', - 'rank': 'captain', - 'age': 36, - 'specialization': 'Medical Officer', - 'years_experience': 12, - 'is_active': True - }, - { - 'member_id': 'CM022', - 'name': 'John Garcia', - 'rank': 'cadet', - 'age': 46, - 'specialization': 'Security', - 'years_experience': 25, - 'is_active': True - }, - { - 'member_id': 'CM023', - 'name': 'Michael Johnson', - 'rank': 'officer', - 'age': 54, - 'specialization': 'Research', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM024', - 'name': 'Sarah Rodriguez', - 'rank': 'lieutenant', - 'age': 54, - 'specialization': 'Research', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM025', - 'name': 'Maria Smith', - 'rank': 'cadet', - 'age': 38, - 'specialization': 'Communications', - 'years_experience': 15, - 'is_active': True - } - ], - 'mission_status': 'planned', - 'budget_millions': 4976.0 - }, - { - 'mission_id': 'M2024_LUNA', - 'mission_name': 'Mars Colony Mission', - 'destination': 'Mars', - 'launch_date': '2024-06-13T00:00:00', - 'duration_days': 222, - 'crew': [ - { - 'member_id': 'CM031', - 'name': 'Anna Davis', - 'rank': 'commander', - 'age': 27, - 'specialization': 'Communications', - 'years_experience': 14, - 'is_active': True - }, - { - 'member_id': 'CM032', - 'name': 'Elena Garcia', - 'rank': 'lieutenant', - 'age': 42, - 'specialization': 'Science Officer', - 'years_experience': 23, - 'is_active': True - }, - { - 'member_id': 'CM033', - 'name': 'Anna Brown', - 'rank': 'officer', - 'age': 55, - 'specialization': 'Engineering', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM034', - 'name': 'Emma Smith', - 'rank': 'captain', - 'age': 37, - 'specialization': 'Research', - 'years_experience': 23, - 'is_active': True - }, - { - 'member_id': 'CM035', - 'name': 'Sofia Smith', - 'rank': 'lieutenant', - 'age': 53, - 'specialization': 'Security', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM036', - 'name': 'Maria Hernandez', - 'rank': 'commander', - 'age': 41, - 'specialization': 'Medical Officer', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM037', - 'name': 'John Hernandez', - 'rank': 'officer', - 'age': 42, - 'specialization': 'Science Officer', - 'years_experience': 20, - 'is_active': True - } - ], - 'mission_status': 'planned', - 'budget_millions': 4984.6 - }, - { - 'mission_id': 'M2024_EUROPA', - 'mission_name': 'Saturn Rings Research Mission', - 'destination': 'Saturn Rings', - 'launch_date': '2024-09-18T00:00:00', - 'duration_days': 602, - 'crew': [ - { - 'member_id': 'CM041', - 'name': 'William Davis', - 'rank': 'captain', - 'age': 35, - 'specialization': 'Medical Officer', - 'years_experience': 14, - 'is_active': True - }, - { - 'member_id': 'CM042', - 'name': 'Sarah Smith', - 'rank': 'captain', - 'age': 55, - 'specialization': 'Research', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM043', - 'name': 'Elena Garcia', - 'rank': 'commander', - 'age': 55, - 'specialization': 'Research', - 'years_experience': 30, - 'is_active': True - }, - { - 'member_id': 'CM044', - 'name': 'Sofia Williams', - 'rank': 'officer', - 'age': 30, - 'specialization': 'Systems Analysis', - 'years_experience': 9, - 'is_active': True - }, - { - 'member_id': 'CM045', - 'name': 'Sarah Jones', - 'rank': 'lieutenant', - 'age': 25, - 'specialization': 'Maintenance', - 'years_experience': 11, - 'is_active': True - }, - { - 'member_id': 'CM046', - 'name': 'Lisa Rodriguez', - 'rank': 'officer', - 'age': 30, - 'specialization': 'Life Support', - 'years_experience': 12, - 'is_active': True - }, - { - 'member_id': 'CM047', - 'name': 'Sarah Smith', - 'rank': 'cadet', - 'age': 28, - 'specialization': 'Pilot', - 'years_experience': 8, - 'is_active': True - } - ], - 'mission_status': 'planned', - 'budget_millions': 1092.6 - } -] diff --git a/09/generated_data/space_stations.csv b/09/generated_data/space_stations.csv deleted file mode 100644 index 6aa1fb2..0000000 --- a/09/generated_data/space_stations.csv +++ /dev/null @@ -1,11 +0,0 @@ -crew_size,is_operational,last_maintenance,name,notes,oxygen_level,power_level,station_id -6,True,2023-07-11T00:00:00,Titan Mining Outpost,,95.5,76.4,LGW125 -3,False,2023-08-24T00:00:00,Deep Space Observatory,System diagnostics required,88.1,70.8,QCH189 -11,True,2023-10-21T00:00:00,Europa Research Station,,91.4,82.0,ISS674 -9,False,2023-10-06T00:00:00,Mars Orbital Platform,System diagnostics required,87.2,79.7,ISS877 -4,False,2023-10-25T00:00:00,Deep Space Observatory,System diagnostics required,89.9,80.2,LGW194 -11,False,2023-12-11T00:00:00,Solar Wind Monitor,System diagnostics required,98.1,73.6,ISS847 -12,False,2023-07-15T00:00:00,Asteroid Belt Relay,System diagnostics required,86.0,75.5,QCH400 -4,True,2023-09-25T00:00:00,Titan Mining Outpost,All systems nominal,97.3,94.4,ERS891 -8,False,2023-07-10T00:00:00,Asteroid Belt Relay,System diagnostics required,88.8,76.0,ABR266 -11,False,2023-09-25T00:00:00,Mars Orbital Platform,System diagnostics required,87.3,90.8,LGW723 diff --git a/09/generated_data/space_stations.json b/09/generated_data/space_stations.json deleted file mode 100644 index 3e32acb..0000000 --- a/09/generated_data/space_stations.json +++ /dev/null @@ -1,102 +0,0 @@ -[ - { - "station_id": "LGW125", - "name": "Titan Mining Outpost", - "crew_size": 6, - "power_level": 76.4, - "oxygen_level": 95.5, - "last_maintenance": "2023-07-11T00:00:00", - "is_operational": true, - "notes": null - }, - { - "station_id": "QCH189", - "name": "Deep Space Observatory", - "crew_size": 3, - "power_level": 70.8, - "oxygen_level": 88.1, - "last_maintenance": "2023-08-24T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "ISS674", - "name": "Europa Research Station", - "crew_size": 11, - "power_level": 82.0, - "oxygen_level": 91.4, - "last_maintenance": "2023-10-21T00:00:00", - "is_operational": true, - "notes": null - }, - { - "station_id": "ISS877", - "name": "Mars Orbital Platform", - "crew_size": 9, - "power_level": 79.7, - "oxygen_level": 87.2, - "last_maintenance": "2023-10-06T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "LGW194", - "name": "Deep Space Observatory", - "crew_size": 4, - "power_level": 80.2, - "oxygen_level": 89.9, - "last_maintenance": "2023-10-25T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "ISS847", - "name": "Solar Wind Monitor", - "crew_size": 11, - "power_level": 73.6, - "oxygen_level": 98.1, - "last_maintenance": "2023-12-11T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "QCH400", - "name": "Asteroid Belt Relay", - "crew_size": 12, - "power_level": 75.5, - "oxygen_level": 86.0, - "last_maintenance": "2023-07-15T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "ERS891", - "name": "Titan Mining Outpost", - "crew_size": 4, - "power_level": 94.4, - "oxygen_level": 97.3, - "last_maintenance": "2023-09-25T00:00:00", - "is_operational": true, - "notes": "All systems nominal" - }, - { - "station_id": "ABR266", - "name": "Asteroid Belt Relay", - "crew_size": 8, - "power_level": 76.0, - "oxygen_level": 88.8, - "last_maintenance": "2023-07-10T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - }, - { - "station_id": "LGW723", - "name": "Mars Orbital Platform", - "crew_size": 11, - "power_level": 90.8, - "oxygen_level": 87.3, - "last_maintenance": "2023-09-25T00:00:00", - "is_operational": false, - "notes": "System diagnostics required" - } -] \ No newline at end of file diff --git a/09/generated_data/space_stations.py b/09/generated_data/space_stations.py deleted file mode 100644 index 8ce741f..0000000 --- a/09/generated_data/space_stations.py +++ /dev/null @@ -1,106 +0,0 @@ -""" -Generated test data for space_stations -""" - -SPACE_STATIONS = [ - { - 'station_id': 'LGW125', - 'name': 'Titan Mining Outpost', - 'crew_size': 6, - 'power_level': 76.4, - 'oxygen_level': 95.5, - 'last_maintenance': '2023-07-11T00:00:00', - 'is_operational': True, - 'notes': None - }, - { - 'station_id': 'QCH189', - 'name': 'Deep Space Observatory', - 'crew_size': 3, - 'power_level': 70.8, - 'oxygen_level': 88.1, - 'last_maintenance': '2023-08-24T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'ISS674', - 'name': 'Europa Research Station', - 'crew_size': 11, - 'power_level': 82.0, - 'oxygen_level': 91.4, - 'last_maintenance': '2023-10-21T00:00:00', - 'is_operational': True, - 'notes': None - }, - { - 'station_id': 'ISS877', - 'name': 'Mars Orbital Platform', - 'crew_size': 9, - 'power_level': 79.7, - 'oxygen_level': 87.2, - 'last_maintenance': '2023-10-06T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'LGW194', - 'name': 'Deep Space Observatory', - 'crew_size': 4, - 'power_level': 80.2, - 'oxygen_level': 89.9, - 'last_maintenance': '2023-10-25T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'ISS847', - 'name': 'Solar Wind Monitor', - 'crew_size': 11, - 'power_level': 73.6, - 'oxygen_level': 98.1, - 'last_maintenance': '2023-12-11T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'QCH400', - 'name': 'Asteroid Belt Relay', - 'crew_size': 12, - 'power_level': 75.5, - 'oxygen_level': 86.0, - 'last_maintenance': '2023-07-15T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'ERS891', - 'name': 'Titan Mining Outpost', - 'crew_size': 4, - 'power_level': 94.4, - 'oxygen_level': 97.3, - 'last_maintenance': '2023-09-25T00:00:00', - 'is_operational': True, - 'notes': 'All systems nominal' - }, - { - 'station_id': 'ABR266', - 'name': 'Asteroid Belt Relay', - 'crew_size': 8, - 'power_level': 76.0, - 'oxygen_level': 88.8, - 'last_maintenance': '2023-07-10T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - }, - { - 'station_id': 'LGW723', - 'name': 'Mars Orbital Platform', - 'crew_size': 11, - 'power_level': 90.8, - 'oxygen_level': 87.3, - 'last_maintenance': '2023-09-25T00:00:00', - 'is_operational': False, - 'notes': 'System diagnostics required' - } -]