MSaabith commited on
Commit
0ff0f35
·
verified ·
1 Parent(s): 2f77b9f

what abot the drug iteractuion and other stuff /

Browse files
components/drug-interaction.js ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class DrugInteractionChecker extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ padding: 1rem;
9
+ background: white;
10
+ border-radius: 0.5rem;
11
+ box-shadow: 0 1px 3px rgba(0,0,0,0.1);
12
+ }
13
+ .container {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 1rem;
17
+ }
18
+ .input-group {
19
+ display: flex;
20
+ gap: 0.5rem;
21
+ }
22
+ input {
23
+ flex: 1;
24
+ padding: 0.5rem;
25
+ border: 1px solid #ccc;
26
+ border-radius: 0.25rem;
27
+ }
28
+ button {
29
+ background: #3b82f6;
30
+ color: white;
31
+ border: none;
32
+ padding: 0.5rem 1rem;
33
+ border-radius: 0.25rem;
34
+ cursor: pointer;
35
+ }
36
+ .results {
37
+ margin-top: 1rem;
38
+ border-top: 1px solid #eee;
39
+ padding-top: 1rem;
40
+ }
41
+ .interaction {
42
+ padding: 0.5rem;
43
+ margin-bottom: 0.5rem;
44
+ border-radius: 0.25rem;
45
+ }
46
+ .severe { background: #fee2e2; border-left: 3px solid #ef4444; }
47
+ .moderate { background: #fef3c7; border-left: 3px solid #f59e0b; }
48
+ .minor { background: #ecfdf5; border-left: 3px solid #10b981; }
49
+ </style>
50
+ <div class="container">
51
+ <h3>Drug Interaction Checker</h3>
52
+ <div class="input-group">
53
+ <input type="text" id="drug1" placeholder="Enter first drug name">
54
+ <input type="text" id="drug2" placeholder="Enter second drug name">
55
+ <button id="check-btn">Check</button>
56
+ </div>
57
+ <div class="results" id="results"></div>
58
+ </div>
59
+ `;
60
+
61
+ this.shadowRoot.getElementById('check-btn').addEventListener('click', this.checkInteractions.bind(this));
62
+ }
63
+
64
+ async checkInteractions() {
65
+ const drug1 = this.shadowRoot.getElementById('drug1').value;
66
+ const drug2 = this.shadowRoot.getElementById('drug2').value;
67
+
68
+ if (!drug1 || !drug2) {
69
+ this.showError('Please enter both drug names');
70
+ return;
71
+ }
72
+
73
+ // Simulate API call with mock data
74
+ this.showLoading();
75
+
76
+ setTimeout(() => {
77
+ const mockResults = this.getMockInteractions(drug1, drug2);
78
+ this.displayResults(mockResults);
79
+ }, 1000);
80
+ }
81
+
82
+ showLoading() {
83
+ this.shadowRoot.getElementById('results').innerHTML = '<p>Checking interactions...</p>';
84
+ }
85
+
86
+ showError(message) {
87
+ this.shadowRoot.getElementById('results').innerHTML = `<p class="error">${message}</p>`;
88
+ }
89
+
90
+ getMockInteractions(drug1, drug2) {
91
+ // This would be replaced with actual API calls in production
92
+ const mockData = {
93
+ "drug1": drug1,
94
+ "drug2": drug2,
95
+ "interactions": [
96
+ {
97
+ "severity": "severe",
98
+ "description": `${drug1} may increase the hypotensive activities of ${drug2}.`,
99
+ "action": "Monitor blood pressure and consider alternative therapy."
100
+ },
101
+ {
102
+ "severity": "moderate",
103
+ "description": `${drug1} may decrease the effectiveness of ${drug2}.`,
104
+ "action": "Consider dose adjustment or alternative therapy."
105
+ }
106
+ ]
107
+ };
108
+ return mockData;
109
+ }
110
+
111
+ displayResults(data) {
112
+ const resultsEl = this.shadowRoot.getElementById('results');
113
+
114
+ if (data.interactions.length === 0) {
115
+ resultsEl.innerHTML = `<p>No significant interactions found between ${data.drug1} and ${data.drug2}.</p>`;
116
+ return;
117
+ }
118
+
119
+ let html = `<h4>Interactions between ${data.drug1} and ${data.drug2}:</h4>`;
120
+
121
+ data.interactions.forEach(interaction => {
122
+ html += `
123
+ <div class="interaction ${interaction.severity}">
124
+ <p><strong>Severity:</strong> ${interaction.severity.toUpperCase()}</p>
125
+ <p><strong>Description:</strong> ${interaction.description}</p>
126
+ <p><strong>Recommendation:</strong> ${interaction.action}</p>
127
+ </div>
128
+ `;
129
+ });
130
+
131
+ resultsEl.innerHTML = html;
132
+ }
133
+ }
134
+
135
+ customElements.define('drug-interaction-checker', DrugInteractionChecker);
components/navbar.js CHANGED
@@ -182,6 +182,7 @@ class CustomNavbar extends HTMLElement {
182
  </a>
183
  <div class="nav-links">
184
  <a href="features.html">Features</a>
 
185
  <a href="pricing.html">Pricing</a>
186
  <a href="resources.html">Resources</a>
187
  <a href="about.html">About</a>
@@ -197,10 +198,11 @@ class CustomNavbar extends HTMLElement {
197
  </div>
198
  <div class="mobile-menu">
199
  <a href="features.html">Features</a>
 
200
  <a href="pricing.html">Pricing</a>
201
  <a href="resources.html">Resources</a>
202
  <a href="about.html">About</a>
203
- <div class="divider"></div>
204
  <a href="login.html" class="button">Log in</a>
205
  <a href="register.html" class="button">Sign up</a>
206
  </div>
 
182
  </a>
183
  <div class="nav-links">
184
  <a href="features.html">Features</a>
185
+ <a href="interactions.html">Drug Interactions</a>
186
  <a href="pricing.html">Pricing</a>
187
  <a href="resources.html">Resources</a>
188
  <a href="about.html">About</a>
 
198
  </div>
199
  <div class="mobile-menu">
200
  <a href="features.html">Features</a>
201
+ <a href="interactions.html">Drug Interactions</a>
202
  <a href="pricing.html">Pricing</a>
203
  <a href="resources.html">Resources</a>
204
  <a href="about.html">About</a>
205
+ <div class="divider"></div>
206
  <a href="login.html" class="button">Log in</a>
207
  <a href="register.html" class="button">Sign up</a>
208
  </div>
interactions.html ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Drug Interactions - CureLens AI</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="components/navbar.js"></script>
11
+ <script src="components/footer.js"></script>
12
+ <script src="components/drug-interaction.js"></script>
13
+ </head>
14
+ <body class="bg-gray-50 min-h-screen flex flex-col">
15
+ <custom-navbar></custom-navbar>
16
+
17
+ <main class="flex-grow container mx-auto px-4 py-8">
18
+ <div class="max-w-4xl mx-auto">
19
+ <h1 class="text-3xl font-bold text-gray-800 mb-6">Drug Interaction Checker</h1>
20
+ <p class="text-gray-600 mb-8">
21
+ Check for potential interactions between medications. Our AI analyzes thousands of drug combinations
22
+ to help you make safer prescribing decisions.
23
+ </p>
24
+
25
+ <div class="bg-white rounded-xl shadow-md p-6 mb-8">
26
+ <drug-interaction-checker></drug-interaction-checker>
27
+ </div>
28
+
29
+ <div class="bg-white rounded-xl shadow-md p-6">
30
+ <h2 class="text-2xl font-bold text-gray-800 mb-4">Common Drug Interactions</h2>
31
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
32
+ <div class="p-4 border rounded-lg">
33
+ <h3 class="font-semibold mb-2">Warfarin + NSAIDs</h3>
34
+ <p class="text-sm text-gray-600">Increased risk of bleeding</p>
35
+ </div>
36
+ <div class="p-4 border rounded-lg">
37
+ <h3 class="font-semibold mb-2">SSRIs + MAOIs</h3>
38
+ <p class="text-sm text-gray-600">Risk of serotonin syndrome</p>
39
+ </div>
40
+ <div class="p-4 border rounded-lg">
41
+ <h3 class="font-semibold mb-2">Statins + Grapefruit</h3>
42
+ <p class="text-sm text-gray-600">Increased statin levels</p>
43
+ </div>
44
+ <div class="p-4 border rounded-lg">
45
+ <h3 class="font-semibold mb-2">Digoxin + Diuretics</h3>
46
+ <p class="text-sm text-gray-600">Risk of hypokalemia</p>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </main>
52
+
53
+ <custom-footer></custom-footer>
54
+ <script>
55
+ feather.replace();
56
+ </script>
57
+ </body>
58
+ </html>
style.css CHANGED
@@ -11,6 +11,13 @@ body {
11
  .hero {
12
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
13
  }
 
 
 
 
 
 
 
14
 
15
  /* Custom scrollbar */
16
  ::-webkit-scrollbar {
 
11
  .hero {
12
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
13
  }
14
+ /* Drug Interaction Styles */
15
+ .error {
16
+ color: #ef4444;
17
+ padding: 0.5rem;
18
+ background: #fee2e2;
19
+ border-radius: 0.25rem;
20
+ }
21
 
22
  /* Custom scrollbar */
23
  ::-webkit-scrollbar {