|
1 | 1 | --- |
2 | | -description: Follow this rules for every request |
| 2 | +description: |
3 | 3 | globs: |
| 4 | +alwaysApply: true |
4 | 5 | --- |
5 | | - |
6 | 6 | - Project Proposal Overview: This project proposes an AI-powered medical report translator that simplifies complex medical documents for patients and caregivers. By leveraging AI-driven text extraction and natural language processing (NLP), the system translates medical jargon into plain language, helping users understand their health conditions, diagnoses, and test results without relying on unreliable online searches. |
7 | 7 |
|
8 | 8 | - Why are we doing this? Patients often receive medical reports full of complex terminology, abbreviations, and technical language that they don’t understand, causing confusion, stress, and potential misinterpretation of their health conditions. Many resort to Google searches or unreliable forums to decipher their reports, leading to misinformation and anxiety. By automating medical report simplification, we help patients take control of their healthcare, make informed decisions, and reduce the dependency on doctors for basic explanations. |
@@ -67,7 +67,10 @@ Technologies: |
67 | 67 | [5 - Results analysis.png](mdc:docs/assets/images/5 - Results analysis.png) |
68 | 68 | [6 - Results Archive.png](mdc:docs/assets/images/6 - Results Archive.png) |
69 | 69 | [7 - Detail.png](mdc:docs/assets/images/7 - Detail.png) |
70 | | - |
| 70 | +[Upload_default.png](mdc:docs/assets/images/Upload_default.png) |
| 71 | +[Upload_success.png](mdc:docs/assets/images/Upload_success.png) |
| 72 | +[Uploading.png](mdc:docs/assets/images/Uploading.png) |
| 73 | +[Uploading_complete.png](mdc:docs/assets/images/Uploading_complete.png) |
71 | 74 |
|
72 | 75 | AWS architecture: [aws architecture.pdf](mdc:docs/assets/aws architecture.pdf) |
73 | 76 |
|
@@ -121,10 +124,37 @@ AWS architecture: [aws architecture.pdf](mdc:docs/assets/aws architecture.pdf) |
121 | 124 | ``` |
122 | 125 | ``` |
123 | 126 |
|
| 127 | +# General Code Guidelines |
| 128 | + |
| 129 | +## Category Determination Pattern |
| 130 | +When determining categories based on keywords in filenames or text: |
| 131 | + |
| 132 | +1. Define a constant mapping object at module level that maps categories to their identifying keywords |
| 133 | +2. Use TypeScript's Record type to ensure type safety |
| 134 | +3. Convert input to lowercase once at the start |
| 135 | +4. Use Array methods like `find` and `some` for clean keyword matching |
| 136 | +5. Provide a default/fallback category |
| 137 | +6. Include JSDoc with clear parameter and return descriptions |
| 138 | + |
| 139 | +Example: |
| 140 | +```typescript |
| 141 | +const CATEGORY_KEYWORDS: Record<Category, string[]> = { |
| 142 | + [Category.TYPE_A]: ['keyword1', 'keyword2'], |
| 143 | + [Category.TYPE_B]: ['keyword3', 'keyword4'], |
| 144 | + [Category.DEFAULT]: [] |
| 145 | +}; |
| 146 | + |
| 147 | +const determineCategory = (input: string): Category => { |
| 148 | + const lowerInput = input.toLowerCase(); |
| 149 | + const matchedCategory = Object.entries(CATEGORY_KEYWORDS) |
| 150 | + .find(([_, keywords]) => keywords.some(k => lowerInput.includes(k))); |
| 151 | + return matchedCategory ? (matchedCategory[0] as Category) : Category.DEFAULT; |
| 152 | +}; |
| 153 | +``` |
| 154 | + |
124 | 155 | # Typescript rules |
125 | 156 |
|
126 | 157 | - Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator. |
127 | 158 |
|
128 | 159 | This rule provides clear guidelines on what units to use, how to convert between units, and why it's important for your project. You can add this to your general rules to ensure consistency across the codebase. |
129 | 160 |
|
130 | | -Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator. |
|
0 commit comments