Extract idea information from different formats
(idea)
| 27 | SCI_SYMLINK_DIRS = {'data', 'related_work', 'target_study'} |
| 28 | |
| 29 | def extract_idea_info(idea): |
| 30 | """Extract idea information from different formats""" |
| 31 | # Try refined_method_details first (from full MAS pipeline) |
| 32 | if 'refined_method_details' in idea and idea['refined_method_details']: |
| 33 | details = idea['refined_method_details'] |
| 34 | return { |
| 35 | 'name': details.get('name', 'unnamed_idea'), |
| 36 | 'title': details.get('title', 'Untitled'), |
| 37 | 'description': details.get('description', ''), |
| 38 | 'method': details.get('method', '') |
| 39 | } |
| 40 | |
| 41 | # Fall back to method_details (from method development only) |
| 42 | elif 'method_details' in idea and idea['method_details']: |
| 43 | details = idea['method_details'] |
| 44 | return { |
| 45 | 'name': details.get('name', 'unnamed_idea'), |
| 46 | 'title': details.get('title', 'Untitled'), |
| 47 | 'description': details.get('description', ''), |
| 48 | 'method': details.get('method', '') |
| 49 | } |
| 50 | |
| 51 | # Fall back to basic idea structure (from JSON files) |
| 52 | else: |
| 53 | # Handle different possible field names |
| 54 | name = idea.get('name') or idea.get('title') or 'unnamed_idea' |
| 55 | title = idea.get('title') or idea.get('name') or 'Untitled' |
| 56 | description = idea.get('description') or idea.get('content') or '' |
| 57 | method = idea.get('method') or '' |
| 58 | |
| 59 | return { |
| 60 | 'name': name[:50] if name else 'unnamed_idea', # Limit name length |
| 61 | 'title': title, |
| 62 | 'description': description, |
| 63 | 'method': method |
| 64 | } |
| 65 | |
| 66 | |
| 67 | def info_traceback(stderr): |
no test coverage detected