Skip to content

Commit

Permalink
Merge pull request #21 from columbiaspace/equipmentcards
Browse files Browse the repository at this point in the history
added posting of new ER procedures to DB
  • Loading branch information
adenjonah authored May 17, 2024
2 parents 60d63a8 + b2d01d7 commit ce1e7d1
Show file tree
Hide file tree
Showing 4 changed files with 429 additions and 10 deletions.
180 changes: 179 additions & 1 deletion server/json_databases/equipment_repair.json
Original file line number Diff line number Diff line change
@@ -1 +1,179 @@
{"procedures": [{"id": 1, "title": "Structural Damage Repair", "steps": [{"step": "Comm Tower Base 1", "role": "EV1", "description": "Collect structural repair materials including metal patches, welding tools, and adhesives."}, {"step": "Comm Tower Base 2", "role": "EV2", "description": "Assemble safety gear for climbing and securing both crew members."}, {"step": "Comm Tower 3", "role": "EV1", "description": "Assess tower for visible structural damage."}, {"step": "Comm Tower 4", "role": "EV2", "description": "Assist in removing debris and damaged components."}, {"step": "Comm Tower 5", "role": "EV1", "description": "Apply metal patches over holes or tears using welding tools."}, {"step": "Comm Tower 6", "role": "EV2", "description": "Provide support in applying patches or adhesives."}, {"step": "Comm Tower 7", "role": "EV1", "description": "Secure larger structural issues with adhesives and temporary supports."}, {"step": "Comm Tower 8", "role": "EV2", "description": "Ensure safety protocols are followed during high or difficult access points."}]}, {"id": 2, "title": "Power System Troubleshooting and Repair", "steps": [{"step": "Tower Base PSU 1", "role": "EV1", "description": "Assemble diagnostic kit, spare batteries, solar cells, and electrical repair tools."}, {"step": "Tower Base PSU 2", "role": "EV2", "description": "Carry additional spare parts and protective equipment."}, {"step": "Tower Base PSU 3", "role": "EV1", "description": "Perform diagnostics to identify power supply issues."}, {"step": "Tower Base PSU 4", "role": "EV2", "description": "Assist in identifying damaged components."}, {"step": "Tower Base PSU 5", "role": "EV1", "description": "Replace faulty batteries or solar cells."}, {"step": "Tower Base PSU 6", "role": "EV2", "description": "Help in repairing or replacing wiring, ensuring secure connections."}, {"step": "Tower Base PSU 7", "role": "EV1", "description": "Verify power system functionality post-repair."}]}, {"id": 3, "title": "Antenna Alignment and Calibration", "steps": [{"step": "Comm Tower Antenna 1", "role": "EV1", "description": "Prepare alignment tools and calibration software on a portable device."}, {"step": "Comm Tower Antenna 2", "role": "EV2", "description": "Assemble securing gear and safety equipment for both crew members."}, {"step": "Comm Tower Antenna 3", "role": "EV1", "description": "Adjust the antenna to correct orientation using tools."}, {"step": "Comm Tower Antenna 4", "role": "EV2", "description": "Assist in antenna inspection for misalignment or damage."}, {"step": "Comm Tower Antenna 5", "role": "EV1", "description": "Secure antenna position; perform calibration test."}, {"step": "Comm Tower Antenna 6", "role": "EV2", "description": "Support in adjustment and calibration process; maintain communication with mission control."}]}, {"id": 4, "title": "Transceiver Module Replacement", "steps": [{"step": "Comm Tower Transceiver 1", "role": "EV1", "description": "Collect replacement transceiver module and non-conductive tools."}, {"step": "Comm Tower Transceiver 2", "role": "EV2", "description": "Prepare electrostatic discharge safety equipment."}, {"step": "Comm Tower Transceiver 3", "role": "EV1", "description": "Remove the faulty module."}, {"step": "Comm Tower Transceiver 4", "role": "EV2", "description": "Assist in isolating power supply."}, {"step": "Comm Tower Transceiver 5", "role": "EV1", "description": "Install the new module ensuring all connections are secure."}, {"step": "Comm Tower Transceiver 6", "role": "EV2", "description": "Ensure module installation is correctly performed; conduct systems check to verify functionality."}]}]}
{
"procedures": [
{
"id": 1,
"title": "Structural Damage Repair",
"steps": [
{
"step": "Comm Tower Base 1",
"role": "EV1",
"description": "Collect structural repair materials including metal patches, welding tools, and adhesives."
},
{
"step": "Comm Tower Base 2",
"role": "EV2",
"description": "Assemble safety gear for climbing and securing both crew members."
},
{
"step": "Comm Tower 3",
"role": "EV1",
"description": "Assess tower for visible structural damage."
},
{
"step": "Comm Tower 4",
"role": "EV2",
"description": "Assist in removing debris and damaged components."
},
{
"step": "Comm Tower 5",
"role": "EV1",
"description": "Apply metal patches over holes or tears using welding tools."
},
{
"step": "Comm Tower 6",
"role": "EV2",
"description": "Provide support in applying patches or adhesives."
},
{
"step": "Comm Tower 7",
"role": "EV1",
"description": "Secure larger structural issues with adhesives and temporary supports."
},
{
"step": "Comm Tower 8",
"role": "EV2",
"description": "Ensure safety protocols are followed during high or difficult access points."
}
]
},
{
"id": 2,
"title": "Power System Troubleshooting and Repair",
"steps": [
{
"step": "Tower Base PSU 1",
"role": "EV1",
"description": "Assemble diagnostic kit, spare batteries, solar cells, and electrical repair tools."
},
{
"step": "Tower Base PSU 2",
"role": "EV2",
"description": "Carry additional spare parts and protective equipment."
},
{
"step": "Tower Base PSU 3",
"role": "EV1",
"description": "Perform diagnostics to identify power supply issues."
},
{
"step": "Tower Base PSU 4",
"role": "EV2",
"description": "Assist in identifying damaged components."
},
{
"step": "Tower Base PSU 5",
"role": "EV1",
"description": "Replace faulty batteries or solar cells."
},
{
"step": "Tower Base PSU 6",
"role": "EV2",
"description": "Help in repairing or replacing wiring, ensuring secure connections."
},
{
"step": "Tower Base PSU 7",
"role": "EV1",
"description": "Verify power system functionality post-repair."
}
]
},
{
"id": 3,
"title": "Antenna Alignment and Calibration",
"steps": [
{
"step": "Comm Tower Antenna 1",
"role": "EV1",
"description": "Prepare alignment tools and calibration software on a portable device."
},
{
"step": "Comm Tower Antenna 2",
"role": "EV2",
"description": "Assemble securing gear and safety equipment for both crew members."
},
{
"step": "Comm Tower Antenna 3",
"role": "EV1",
"description": "Adjust the antenna to correct orientation using tools."
},
{
"step": "Comm Tower Antenna 4",
"role": "EV2",
"description": "Assist in antenna inspection for misalignment or damage."
},
{
"step": "Comm Tower Antenna 5",
"role": "EV1",
"description": "Secure antenna position; perform calibration test."
},
{
"step": "Comm Tower Antenna 6",
"role": "EV2",
"description": "Support in adjustment and calibration process; maintain communication with mission control."
}
]
},
{
"id": 4,
"title": "Transceiver Module Replacement",
"steps": [
{
"step": "Comm Tower Transceiver 1",
"role": "EV1",
"description": "Collect replacement transceiver module and non-conductive tools."
},
{
"step": "Comm Tower Transceiver 2",
"role": "EV2",
"description": "Prepare electrostatic discharge safety equipment."
},
{
"step": "Comm Tower Transceiver 3",
"role": "EV1",
"description": "Remove the faulty module."
},
{
"step": "Comm Tower Transceiver 4",
"role": "EV2",
"description": "Assist in isolating power supply."
},
{
"step": "Comm Tower Transceiver 5",
"role": "EV1",
"description": "Install the new module ensuring all connections are secure."
},
{
"step": "Comm Tower Transceiver 6",
"role": "EV2",
"description": "Ensure module installation is correctly performed; conduct systems check to verify functionality."
}
]
},
{
"id": 80,
"title": "Dance",
"steps": [
{
"step": "left foot forward",
"role": "you",
"description": "yea get it"
},
{
"step": "dougie",
"role": "me",
"description": "ill teach you"
}
]
}
]
}
30 changes: 29 additions & 1 deletion server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,32 @@ async def get_equipment_procedures():
raise HTTPException(status_code=500, detail="Error decoding JSON data")
except Exception as e:
logger.error(f"An unexpected error occurred: {str(e)}")
raise HTTPException(status_code=500, detail="An unexpected error occurred")
raise HTTPException(status_code=500, detail="An unexpected error occurred")

class Step(BaseModel):
step: str
role: str
description: str

class Procedure(BaseModel):
id: int
title: str
steps: list[Step]

@app.post("/add_procedure", response_model=Procedure)
async def add_procedure(procedure: Procedure):
if os.path.exists(EQUIPMENT_REPAIR_FILE):
with open(EQUIPMENT_REPAIR_FILE, 'r') as file:
data = json.load(file)
else:
data = {"procedures": []}

if any(existing_procedure["id"] == procedure.id for existing_procedure in data["procedures"]):
raise HTTPException(status_code=400, detail="Procedure with this ID already exists")

data["procedures"].append(procedure.dict())

with open(EQUIPMENT_REPAIR_FILE, 'w') as file:
json.dump(data, file, indent=4)

return procedure
117 changes: 113 additions & 4 deletions src/pages-style/equipment.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* Equipment.css */
.container {
/* equipment.css */

/* General Styles */
#container {
margin: 20px;
display: flex;
flex-direction: column;
font-family: Arial, sans-serif;
color: #333;
}

h2 {
h2, h3 {
color: #333;
border-bottom: 2px solid #ddd;
padding-bottom: 5px;
Expand All @@ -19,7 +22,7 @@ ul {
}

li {
background: #f9f9f9;
background: #f1f1f1;
margin-bottom: 10px;
padding: 10px;
border-radius: 5px;
Expand All @@ -34,3 +37,109 @@ li strong {
color: red;
font-weight: bold;
}

/* Container for the page content */
#container {
padding: 20px;
}

/* Button styles */
button {
margin: 10px;
padding: 10px 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}

button:hover {
background-color: #0056b3;
}

/* Modal background */
#modal {
display: block; /* Ensure modal is displayed */
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}

/* Modal content */
#modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
width: 50%;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Close button for the modal */
#close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}

#close:hover,
#close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}

/* Form group styles */
.form-group {
margin-bottom: 15px;
}

.form-group label {
display: block;
margin-bottom: 5px;
color: #333;
}

.form-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 5px;
transition: border-color 0.3s ease;
}

.form-group input:focus {
border-color: #007BFF;
}

/* Additional styles for the procedure card */
.procedure-card {
background: #e9ecef;
padding: 15px;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
position: relative;
}

.procedure-header {
display: flex;
justify-content: space-between;
align-items: center;
}

.procedure-header h4 {
margin: 0;
font-size: 1.2em;
color: #666;
}
Loading

0 comments on commit ce1e7d1

Please sign in to comment.