Extract idea information from different formats
(idea)
| 20 | MAX_STDERR_OUTPUT = 30000 |
| 21 | |
| 22 | def extract_idea_info(idea): |
| 23 | """Extract idea information from different formats""" |
| 24 | # Try refined_method_details first (from full MAS pipeline) |
| 25 | if 'refined_method_details' in idea and idea['refined_method_details']: |
| 26 | details = idea['refined_method_details'] |
| 27 | return { |
| 28 | 'name': details.get('name', 'unnamed_idea'), |
| 29 | 'title': details.get('title', 'Untitled'), |
| 30 | 'description': details.get('description', ''), |
| 31 | 'method': details.get('method', '') |
| 32 | } |
| 33 | |
| 34 | # Fall back to method_details (from method development only) |
| 35 | elif 'method_details' in idea and idea['method_details']: |
| 36 | details = idea['method_details'] |
| 37 | return { |
| 38 | 'name': details.get('name', 'unnamed_idea'), |
| 39 | 'title': details.get('title', 'Untitled'), |
| 40 | 'description': details.get('description', ''), |
| 41 | 'method': details.get('method', '') |
| 42 | } |
| 43 | |
| 44 | # Fall back to basic idea structure (from JSON files) |
| 45 | else: |
| 46 | # Handle different possible field names |
| 47 | name = idea.get('name') or idea.get('title') or 'unnamed_idea' |
| 48 | title = idea.get('title') or idea.get('name') or 'Untitled' |
| 49 | description = idea.get('description') or idea.get('content') or '' |
| 50 | method = idea.get('method') or '' |
| 51 | |
| 52 | return { |
| 53 | 'name': name[:50] if name else 'unnamed_idea', # Limit name length |
| 54 | 'title': title, |
| 55 | 'description': description, |
| 56 | 'method': method |
| 57 | } |
| 58 | |
| 59 | |
| 60 | # return (file, line, function, content), message |
no test coverage detected