Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Aditya-Kabra/f6b8da56787fa5cde7b679c2aa844722 to your computer and use it in GitHub Desktop.

Select an option

Save Aditya-Kabra/f6b8da56787fa5cde7b679c2aa844722 to your computer and use it in GitHub Desktop.
My Dialog
Display the source blob
Display the rendered blob
Raw
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["## Part 4: Project Data Structuring\n", "\n", "This part takes the filtered project messages and transforms them into structured data suitable for a showcase or database. For each project message, it:\n", "\n", "- Extracts and formats key information including:\n", " - Title: A clear, concise name for the project\n", " - Description: A brief explanation of the project's purpose\n", " - Key features: Three main capabilities of the project\n", " - Showcasable status: Boolean indicating if the project is complete enough to showcase\n", "- Uses human review to verify AI-generated classifications\n", "- Includes filtering functions to separate showcasable vs. non-showcasable projects\n", "- Implements batch processing to handle large datasets efficiently"], "attachments": {}}, {"cell_type": "markdown", "metadata": {}, "source": ["# Old batches added for reference data for LLM"], "attachments": {}}, {"cell_type": "code", "metadata": {}, "source": ["batch_0 = {\n", " \"1336135239545786410\": {\n", " \"title\": \"FastHTML Video Learning Platform\",\n", " \"description\": \"An educational platform for hosting video lessons with interactive LLM discussions built with FastHTML and MonsterUI\",\n", " \"key_features\": [\n", " \"Video lesson content organization\",\n", " \"LLM-powered discussion capability\",\n", " \"Modal cloud deployment\"\n", " ]\n", " },\n", " \"1337330893026627674\": {\n", " \"title\": \"SAP Data Explorer & BOM Analyzer\",\n", " \"description\": \"Tools for exploring complex SAP data structures and analyzing bill of materials using web scraping and network visualization\",\n", " \"key_features\": [\n", " \"SAP documentation scraping\",\n", " \"NetworkX-based BOM visualization\",\n", " \"nbdev project publishing\"\n", " ]\n", " },\n", " \"1336814245572116480\": {\n", " \"title\": \"AI Code Debugging Challenges\",\n", " \"description\": \"Experiences and challenges with debugging AI-generated code, particularly in cloud infrastructure settings\",\n", " \"key_features\": [\n", " \"Cloud-init troubleshooting\",\n", " \"Multi-GPU process coordination\",\n", " \"Long-running job optimization\"\n", " ]\n", " },\n", " \"1336731806598168656\": {\n", " \"title\": \"Lumindy: Personal Reflection App\",\n", " \"description\": \"A React Native mobile app for daily self-discovery that presents thought-provoking questions and tracks personal growth\",\n", " \"key_features\": [\n", " \"Daily reflection questions\",\n", " \"Personal growth tracking\",\n", " \"iOS App Store deployment\"\n", " ]\n", " },\n", " \"1344720599544631326\": {\n", " \"title\": \"DataFrame UI Component\",\n", " \"description\": \"A FastHTML component for manipulating DataFrames with search, modification, and sorting capabilities\",\n", " \"key_features\": [\n", " \"Search functionality\",\n", " \"Data modification interface\",\n", " \"Narwhals compatibility\"\n", " ]\n", " },\n", " \"1344611337715847168\": {\n", " \"title\": \"Polars in Production\",\n", " \"description\": \"Experience using Polars dataframe library in a production environment with narwhals abstraction layer\",\n", " \"key_features\": [\n", " \"Polars for data processing\",\n", " \"Narwhals abstraction layer\",\n", " \"Small website integration\"\n", " ]\n", " },\n", " \"1342514120456671344\": {\n", " \"title\": \"FrankenUI Multiple Filters\",\n", " \"description\": \"Implementation of FrankenUI's filtering system with multiple filter groups for tags and categories\",\n", " \"key_features\": [\n", " \"Multiple filter groups\",\n", " \"Tag-based filtering\",\n", " \"Diataxis framework integration\"\n", " ]\n", " },\n", " \"1342247538790498416\": {\n", " \"title\": \"FastHTML Authentication System\",\n", " \"description\": \"User authentication system with FastHTML and MonsterUI featuring login, registration, and session management\",\n", " \"key_features\": [\n", " \"User registration and login\",\n", " \"Session management\",\n", " \"Modal cloud deployment\"\n", " ]\n", " },\n", " \"1341143955424804958\": {\n", " \"title\": \"LLM Technical Blog Writing\",\n", " \"description\": \"Experience writing a technical blog about LLMs using SolveIt with context-aware style adaptation\",\n", " \"key_features\": [\n", " \"Writing style adaptation\",\n", " \"Outline-based structure\",\n", " \"Iterative content refinement\"\n", " ]\n", " }\n", "}"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["import json\n", "\n", "# Parse the new_proj_strc JSON string\n", "if isinstance(new_proj_strc, str):\n", " new_projects = json.loads(new_proj_strc)\n", "else:\n", " new_projects = new_proj_strc\n", "\n", "# Create a dictionary with just id and content\n", "new_proj_id_content = {}\n", "for project in new_projects:\n", " message_id = project.get(\"message_id\")\n", " content = project.get(\"content\")\n", " if message_id and content:\n", " new_proj_id_content[message_id] = {\"content\": content}\n", "\n", "# Display the result\n", "print(f\"Extracted {len(new_proj_id_content)} projects\")"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["Extracted 21 projects\n"]}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["import json\n", "if isinstance(new_proj_id_content, str):\n", " proj_data = json.loads(new_proj_id_content)\n", "else:\n", " proj_data = new_proj_id_content\n", "\n", "project_ids = list(proj_data.keys())\n", "\n", "batches = []\n", "for i in range(0, len(project_ids), 10):\n", " batch_ids = project_ids[i:i+10]\n", " batch_content = {proj_id: proj_data[proj_id] for proj_id in batch_ids}\n", " batches.append(batch_content)\n", "\n", "print(f\"Total batches: {len(batches)}\")"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["Total batches: 3\n"]}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["def enrich_structured_data(structured_data, batch_content):\n", " \"\"\"\n", " Enriches structured project data with original content for easier review.\n", " \n", " Args:\n", " structured_data (dict): The structured project data with project IDs as keys\n", " batch_content (dict): The original content with project IDs as keys\n", " \n", " Returns:\n", " dict: Enriched structured data with original content\n", " \"\"\"\n", " enriched_data = {}\n", " \n", " for project_id, project_data in structured_data.items():\n", " if project_id in batch_content:\n", " enriched_data[project_id] = {\n", " **project_data,\n", " \"original_content\": batch_content[project_id][\"content\"]\n", " }\n", " \n", " return enriched_data"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["def filter_showcasable(batch_data):\n", " \"\"\"\n", " Filter a batch to return only entries marked as showcasable=True\n", " \n", " Args:\n", " batch_data (dict): Batch data with project IDs as keys\n", " \n", " Returns:\n", " dict: Filtered dictionary containing only showcasable projects\n", " \"\"\"\n", " showcasable_projects = {}\n", " \n", " for project_id, project_data in batch_data.items():\n", " if project_data.get(\"showcasable\", False):\n", " showcasable_projects[project_id] = project_data\n", " \n", " return showcasable_projects"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["def filter_nonshowcasable(batch_data):\n", " \"\"\"\n", " Filter a batch to return only entries marked as showcasable=False\n", " \n", " Args:\n", " batch_data (dict): Batch data with project IDs as keys\n", " \n", " Returns:\n", " dict: Filtered dictionary containing only nonshowcasable projects\n", " \"\"\"\n", " nonshowcasable_projects = {}\n", " \n", " for project_id, project_data in batch_data.items():\n", " if not project_data.get(\"showcasable\", False):\n", " nonshowcasable_projects[project_id] = project_data\n", " \n", " return nonshowcasable_projects"], "outputs": [], "execution_count": null}, {"cell_type": "markdown", "metadata": {}, "source": ["# Just change batch number after this, entire workflow will remain same."], "attachments": {}}, {"cell_type": "code", "metadata": {}, "source": ["batch_num = 0"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["batches[batch_num]"], "outputs": [{"data": {"text/plain": ["{'1346863543789555863': {'content': \"The '1' was a lesson in how twitter caches images and once you used a 'bad' image you need to feed it a different url to get it to update the image. The bit.ly link wasn't updating the image for me so I reverted to changing the url before I shared it widely. Now, I just learned how to create a Cloudflare redirect to try to fix my error! Thanks for catching that!\"},\n", " '1346752023684710483': {'content': \"Hello everyone,\\n\\nI wanted to share that I\u2019ve recently published my very first blog post. I documented my experiences with the course and using Solveit, and finally took the plunge into blogging. I built my site using FastHTML and MonsterUI frameworks, and I warmly invite you to explore it.\\n\\nHere's my blog: [https://blog-production-311c.up.railway.app/]\\n\\nI've recently set up an account on X to share my journey: [https://x.com/Vikas_awa]\\n\\nThank you for your support and happy reading!\"},\n", " '1346353359581614101': {'content': \"Hi David - thanks for offering to assist. Here's the code for setting the app:\\n```\\nfast_app(\\n str(DB_PATH),\\n hdrs=(SortableJS('.sortable'), Theme.blue.headers()),\\n live=False,\\n **table_config\\n)```\"},\n", " '1346304281170677931': {'content': \"I've been experimenting with SolveIt for robotics. It'd be happy to talk about it sometime. Still very wip, but it's been quite interesting.\"},\n", " '1346279322775720039': {'content': \"sharing my Claudette exploration using SolveIt. https://gist.github.com/giordafrancis/8669e32ea73354ccc8844f31910aaaa8 \\nI've never used Claudette before, but I found it extremely convenient to understand how llms can be used as agents. This concept appeared really complex prior to lessons and SolveIt, but it is now really more approachable for me.\"}}"]}, "metadata": {}, "output_type": "execute_result", "execution_count": null}], "execution_count": null}, {"cell_type": "markdown", "metadata": {}, "source": ["**AI Prompt**\n", "\n", "For each project in the current batch, create structured data with:\n", "\n", "1. Title: Clear, concise title reflecting what was actually built\n", "2. Description: One or two sentence project details explaining the core purpose\n", "3. Key features: Exactly 3 main capabilities explicitly mentioned in the original content\n", "4. Showcasable: Boolean value (True/False) indicating if this is a project suitable for showcase\n", "5. Showcasable reason: Explain the reason to mark True or False\n", "\n", "Guidelines for showcase_ready determination:\n", "- TRUE: projects with clear work done by author\n", "- FALSE: Questions, reflections, learning journeys, ideas, work-in-progress, or conceptual discussions\n", "\n", "General guidelines:\n", "- Stick strictly to what's mentioned in the original content\n", "- Use simple, accessible language avoiding technical jargon\n", "- Don't infer capabilities not explicitly stated\n", "- Focus on completed work rather than aspirational features\n", "- Format output as JSON with project IDs as keys\n", "- Use previous as your primary reference for style and format\n", "\n", "To process batch: $`batches[batch_num]`"]}, {"cell_type": "markdown", "metadata": {}, "source": ["**AI Response**\n", "\n", "I'll create structured data for each project in the current batch, following your guidelines.\n", "\n", "Looking at the content for each project, I'll identify the title, description, key features, and determine if it's showcasable based on whether it represents completed work by the author.\n", "\n", "Here's the structured data for the current batch:\n", "\n", "```json\n", "{\n", " \"1346863543789555863\": {\n", " \"title\": \"Twitter Image Cache Solution\",\n", " \"description\": \"A solution to Twitter image caching issues using Cloudflare redirects\",\n", " \"key_features\": [\n", " \"URL modification for image updates\",\n", " \"Cloudflare redirect implementation\",\n", " \"Image cache refresh technique\"\n", " ],\n", " \"showcasable\": true,\n", " \"showcasable_reason\": \"This is a completed technical solution where the author implemented a Cloudflare redirect to solve an image caching issue\"\n", " },\n", " \"1346752023684710483\": {\n", " \"title\": \"Personal Blog with FastHTML and MonsterUI\",\n", " \"description\": \"A personal blog built using FastHTML and MonsterUI frameworks to document course experiences and Solveit usage\",\n", " \"key_features\": [\n", " \"Course experience documentation\",\n", " \"Railway app deployment\",\n", " \"Social media integration\"\n", " ],\n", " \"showcasable\": true,\n", " \"showcasable_reason\": \"This is a completed project with a deployed blog site and social media presence\"\n", " },\n", " \"1346353359581614101\": {\n", " \"title\": \"SortableJS Application Setup\",\n", " \"description\": \"A FastHTML application using SortableJS and themed components\",\n", " \"key_features\": [\n", " \"SortableJS integration\",\n", " \"Theme customization\",\n", " \"Database connectivity\"\n", " ],\n", " \"showcasable\": true,\n", " \"showcasable_reason\": \"This appears to be a working application with specific implementation details shared by the author\"\n", " },\n", " \"1346304281170677931\": {\n", " \"title\": \"SolveIt for Robotics Experimentation\",\n", " \"description\": \"Exploratory work using SolveIt in robotics applications\",\n", " \"key_features\": [\n", " \"SolveIt integration with robotics\",\n", " \"Experimental implementation\",\n", " \"Robotics workflow enhancement\"\n", " ],\n", " \"showcasable\": false,\n", " \"showcasable_reason\": \"This is explicitly described as a work-in-progress (WIP) without specific completed features or details\"\n", " },\n", " \"1346279322775720039\": {\n", " \"title\": \"Claudette Agent Exploration\",\n", " \"description\": \"An exploration of Claudette for understanding how LLMs can be used as agents\",\n", " \"key_features\": [\n", " \"SolveIt integration with Claudette\",\n", " \"LLM agent implementation\",\n", " \"GitHub Gist documentation\"\n", " ],\n", " \"showcasable\": true,\n", " \"showcasable_reason\": \"This is a completed exploration with shared code via GitHub Gist link\"\n", " }\n", "}\n", "```"]}, {"cell_type": "code", "metadata": {}, "source": ["# Apply the False filter to batch_3_structured\n", "batch_nonshow = filter_nonshowcasable(batch_num_data)\n", "\n", "enriched_batch = enrich_structured_data(batch_nonshow, batches[batch_num])\n", "\n", "for project_id, project_data in enriched_batch.items():\n", " print(f\"\\n{'='*80}\\nPROJECT ID: {project_id}\")\n", " print(f\"TITLE: {project_data['title']}\")\n", " print(f\"DESCRIPTION: {project_data['description']}\")\n", " print(f\"KEY FEATURES:\")\n", " for feature in project_data['key_features']:\n", " print(f\" - {feature}\")\n", " print(f\"SHOWCASABLE: {project_data['showcasable']}\")\n", " print(f\"Reason: {project_data['showcasable_reason']}\")\n", " print(f\"ORIGINAL CONTENT:\\n{project_data['original_content']}\")\n", " print('='*80)"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["\n", "================================================================================\n", "PROJECT ID: 1346304281170677931\n", "TITLE: SolveIt for Robotics Experimentation\n", "DESCRIPTION: Exploratory work using SolveIt in robotics applications\n", "KEY FEATURES:\n", " - SolveIt integration with robotics\n", " - Experimental implementation\n", " - Robotics workflow enhancement\n", "SHOWCASABLE: False\n", "Reason: This is explicitly described as a work-in-progress (WIP) without specific completed features or details\n", "ORIGINAL CONTENT:\n", "I've been experimenting with SolveIt for robotics. It'd be happy to talk about it sometime. Still very wip, but it's been quite interesting.\n", "================================================================================\n"]}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["# Apply the True filter to batch_3_structured\n", "batch_show = filter_showcasable(batch_num_data)\n", "\n", "enriched_batch = enrich_structured_data(batch_show, batches[batch_num])\n", "\n", "for project_id, project_data in enriched_batch.items():\n", " print(f\"\\n{'='*80}\\nPROJECT ID: {project_id}\")\n", " print(f\"TITLE: {project_data['title']}\")\n", " print(f\"DESCRIPTION: {project_data['description']}\")\n", " print(f\"KEY FEATURES:\")\n", " for feature in project_data['key_features']:\n", " print(f\" - {feature}\")\n", " print(f\"SHOWCASABLE: {project_data['showcasable']}\")\n", " print(f\"ORIGINAL CONTENT:\\n{project_data['original_content']}\")\n", " print('='*80)"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["\n", "================================================================================\n", "PROJECT ID: 1346863543789555863\n", "TITLE: Twitter Image Cache Solution\n", "DESCRIPTION: A solution to Twitter image caching issues using Cloudflare redirects\n", "KEY FEATURES:\n", " - URL modification for image updates\n", " - Cloudflare redirect implementation\n", " - Image cache refresh technique\n", "SHOWCASABLE: True\n", "ORIGINAL CONTENT:\n", "The '1' was a lesson in how twitter caches images and once you used a 'bad' image you need to feed it a different url to get it to update the image. The bit.ly link wasn't updating the image for me so I reverted to changing the url before I shared it widely. Now, I just learned how to create a Cloudflare redirect to try to fix my error! Thanks for catching that!\n", "================================================================================\n", "\n", "================================================================================\n", "PROJECT ID: 1346752023684710483\n", "TITLE: Personal Blog with FastHTML and MonsterUI\n", "DESCRIPTION: A personal blog built using FastHTML and MonsterUI frameworks to document course experiences and Solveit usage\n", "KEY FEATURES:\n", " - Course experience documentation\n", " - Railway app deployment\n", " - Social media integration\n", "SHOWCASABLE: True\n", "ORIGINAL CONTENT:\n", "Hello everyone,\n", "\n", "I wanted to share that I\u2019ve recently published my very first blog post. I documented my experiences with the course and using Solveit, and finally took the plunge into blogging. I built my site using FastHTML and MonsterUI frameworks, and I warmly invite you to explore it.\n", "\n", "Here's my blog: [https://blog-production-311c.up.railway.app/]\n", "\n", "I've recently set up an account on X to share my journey: [https://x.com/Vikas_awa]\n", "\n", "Thank you for your support and happy reading!\n", "================================================================================\n", "\n", "================================================================================\n", "PROJECT ID: 1346353359581614101\n", "TITLE: SortableJS Application Setup\n", "DESCRIPTION: A FastHTML application using SortableJS and themed components\n", "KEY FEATURES:\n", " - SortableJS integration\n", " - Theme customization\n", " - Database connectivity\n", "SHOWCASABLE: True\n", "ORIGINAL CONTENT:\n", "Hi David - thanks for offering to assist. Here's the code for setting the app:\n", "```\n", "fast_app(\n", " str(DB_PATH),\n", " hdrs=(SortableJS('.sortable'), Theme.blue.headers()),\n", " live=False,\n", " **table_config\n", ")```\n", "================================================================================\n", "\n", "================================================================================\n", "PROJECT ID: 1346279322775720039\n", "TITLE: Claudette Agent Exploration\n", "DESCRIPTION: An exploration of Claudette for understanding how LLMs can be used as agents\n", "KEY FEATURES:\n", " - SolveIt integration with Claudette\n", " - LLM agent implementation\n", " - GitHub Gist documentation\n", "SHOWCASABLE: True\n", "ORIGINAL CONTENT:\n", "sharing my Claudette exploration using SolveIt. https://gist.github.com/giordafrancis/8669e32ea73354ccc8844f31910aaaa8 \n", "I've never used Claudette before, but I found it extremely convenient to understand how llms can be used as agents. This concept appeared really complex prior to lessons and SolveIt, but it is now really more approachable for me.\n", "================================================================================\n"]}], "execution_count": null}, {"cell_type": "markdown", "metadata": {}, "source": ["**AI Prompt**\n", "\n", "For batch_showcasable\n", "\n", "Please review the structured data against the original content and provide feedback:\n", "\n", "For each entry, rate the accuracy as:\n", "\n", "- \u2705 Good: Accurately represents the original content\n", "- \u26a0\ufe0f Needs Revision: Contains inaccuracies or misinterpretations\n", "- \u274c Poor: Significantly misrepresents the original content\n", "\n", "Provide specific notes for any entries needing revision\n", "\n", "Suggest concrete improvements for problematic entries\n", "\n", "Comment on overall adherence to the formatting guidelines"]}, {"cell_type": "markdown", "metadata": {}, "source": ["**AI Response**\n", "\n", "I'll review each showcasable entry and rate its accuracy against the original content.\n", "\n", "### 1346863543789555863: Twitter Image Cache Solution\n", "**Rating: \u2705 Good**\n", "- The title and description accurately capture the technical solution described\n", "- The key features correctly reflect the URL modification technique and Cloudflare implementation\n", "- Showcasable status is appropriate as this describes a completed technical solution\n", "\n", "### 1346752023684710483: Personal Blog with FastHTML and MonsterUI\n", "**Rating: \u2705 Good**\n", "- Title and description accurately represent the blog creation with the specified frameworks\n", "- Key features properly highlight the main aspects mentioned (documentation, deployment, social media)\n", "- Showcasable status is correct as this is a completed project with links\n", "\n", "### 1346353359581614101: SortableJS Application Setup\n", "**Rating: \u26a0\ufe0f Needs Revision**\n", "- The \"Database connectivity\" feature is inferred rather than explicitly stated\n", "- While DB_PATH suggests database usage, it's not explicitly described in the original content\n", "- Suggested improvement: Replace \"Database connectivity\" with \"Configuration parameter support\" which is more directly evident from the table_config parameter\n", "\n", "### 1346279322775720039: Claudette Agent Exploration\n", "**Rating: \u2705 Good**\n", "- Title and description accurately reflect the exploration of Claudette for agent applications\n", "- Key features correctly highlight the integration with SolveIt and GitHub documentation\n", "- Showcasable status is appropriate as there is a completed exploration with shared code\n", "\n", "### Overall Format Assessment:\n", "- The structured data follows the requested format with project IDs as keys\n", "- Each entry contains all required fields (title, description, key features, showcasable status)\n", "- The language is accessible and avoids unnecessary technical jargon\n", "- The key features are consistently presented as three bullet points\n", "- Showcasable reasons are clearly articulated\n", "\n", "Would you like me to provide a corrected version of the entry that needs revision?"]}, {"cell_type": "code", "metadata": {}, "source": ["batch_show"], "outputs": [{"data": {"text/plain": ["{'1346863543789555863': {'title': 'Twitter Image Cache Solution',\n", " 'description': 'A solution to Twitter image caching issues using Cloudflare redirects',\n", " 'key_features': ['URL modification for image updates',\n", " 'Cloudflare redirect implementation',\n", " 'Image cache refresh technique'],\n", " 'showcasable': True,\n", " 'showcasable_reason': 'This is a completed technical solution where the author implemented a Cloudflare redirect to solve an image caching issue'},\n", " '1346752023684710483': {'title': 'Personal Blog with FastHTML and MonsterUI',\n", " 'description': 'A personal blog built using FastHTML and MonsterUI frameworks to document course experiences and Solveit usage',\n", " 'key_features': ['Course experience documentation',\n", " 'Railway app deployment',\n", " 'Social media integration'],\n", " 'showcasable': True,\n", " 'showcasable_reason': 'This is a completed project with a deployed blog site and social media presence'},\n", " '1346353359581614101': {'title': 'SortableJS Application Setup',\n", " 'description': 'A FastHTML application using SortableJS and themed components',\n", " 'key_features': ['SortableJS integration',\n", " 'Theme customization',\n", " 'Database connectivity'],\n", " 'showcasable': True,\n", " 'showcasable_reason': 'This appears to be a working application with specific implementation details shared by the author'},\n", " '1346279322775720039': {'title': 'Claudette Agent Exploration',\n", " 'description': 'An exploration of Claudette for understanding how LLMs can be used as agents',\n", " 'key_features': ['SolveIt integration with Claudette',\n", " 'LLM agent implementation',\n", " 'GitHub Gist documentation'],\n", " 'showcasable': True,\n", " 'showcasable_reason': 'This is a completed exploration with shared code via GitHub Gist link'}}"]}, "metadata": {}, "output_type": "execute_result", "execution_count": null}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["import json\n", "\n", "# Parse new_proj_strc if it's a string\n", "if isinstance(new_proj_strc, str):\n", " new_projects = json.loads(new_proj_strc)\n", "else:\n", " new_projects = new_proj_strc\n", "\n", "# Create a dictionary to map project IDs to their additional information\n", "additional_info = {}\n", "for project in new_projects:\n", " project_id = project.get(\"message_id\")\n", " if project_id:\n", " # Extract the components you want to keep\n", " additional_info[project_id] = {\n", " \"created_at\": project.get(\"created_at\"),\n", " \"author\": project.get(\"author\"),\n", " \"urls\": project.get(\"urls\", []),\n", " \"content\": project.get(\"content\")\n", " }\n", "\n", "# Update your batch_num_data with this additional information\n", "for project_id in batch_show:\n", " if project_id in additional_info:\n", " # Add the additional information to the existing data\n", " batch_show[project_id].update(additional_info.get(project_id, {}))\n", " if \"showcasable\" in batch_show[project_id]:\n", " del batch_show[project_id][\"showcasable\"]\n", " if \"showcasable_reason\" in batch_show[project_id]:\n", " del batch_show[project_id][\"showcasable_reason\"]\n", "\n", "# Print the complete dictionary in a format that can be easily copied\n", "print(\"batch_show_complete = {\")\n", "for project_id, project_data in batch_show.items():\n", " print(f' \"{project_id}\": {json.dumps(project_data, indent=4)}{\",\" if project_id != list(batch_show.keys())[-1] else \"\"}')\n", "print(\"}\")"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["batch_show_complete = {\n", " \"1346863543789555863\": {\n", " \"title\": \"Twitter Image Cache Solution\",\n", " \"description\": \"A solution to Twitter image caching issues using Cloudflare redirects\",\n", " \"key_features\": [\n", " \"URL modification for image updates\",\n", " \"Cloudflare redirect implementation\",\n", " \"Image cache refresh technique\"\n", " ],\n", " \"author\": \"Drew Echerd\",\n", " \"created_at\": \"2025-03-05T15:14:52.354000+00:00\",\n", " \"urls\": [],\n", " \"created_by_author\": true,\n", " \"content\": \"The '1' was a lesson in how twitter caches images and once you used a 'bad' image you need to feed it a different url to get it to update the image. The bit.ly link wasn't updating the image for me so I reverted to changing the url before I shared it widely. Now, I just learned how to create a Cloudflare redirect to try to fix my error! Thanks for catching that!\"\n", "},\n", " \"1346752023684710483\": {\n", " \"title\": \"Personal Blog with FastHTML and MonsterUI\",\n", " \"description\": \"A personal blog built using FastHTML and MonsterUI frameworks to document course experiences and Solveit usage\",\n", " \"key_features\": [\n", " \"Course experience documentation\",\n", " \"Railway app deployment\",\n", " \"Social media integration\"\n", " ],\n", " \"author\": \"Vikas Awasthi\",\n", " \"created_at\": \"2025-03-05T07:51:43.889000+00:00\",\n", " \"urls\": [\n", " \"https://blog-production-311c.up.railway.app/]\",\n", " \"https://x.com/Vikas_awa]\"\n", " ],\n", " \"created_by_author\": true,\n", " \"content\": \"Hello everyone,\\n\\nI wanted to share that I\\u2019ve recently published my very first blog post. I documented my experiences with the course and using Solveit, and finally took the plunge into blogging. I built my site using FastHTML and MonsterUI frameworks, and I warmly invite you to explore it.\\n\\nHere's my blog: [https://blog-production-311c.up.railway.app/]\\n\\nI've recently set up an account on X to share my journey: [https://x.com/Vikas_awa]\\n\\nThank you for your support and happy reading!\"\n", "},\n", " \"1346353359581614101\": {\n", " \"title\": \"SortableJS Application Setup\",\n", " \"description\": \"A FastHTML application using SortableJS and themed components\",\n", " \"key_features\": [\n", " \"SortableJS integration\",\n", " \"Theme customization\",\n", " \"Database connectivity\"\n", " ],\n", " \"author\": \"Darren\",\n", " \"created_at\": \"2025-03-04T05:27:34.960000+00:00\",\n", " \"urls\": [],\n", " \"created_by_author\": true,\n", " \"content\": \"Hi David - thanks for offering to assist. Here's the code for setting the app:\\n```\\nfast_app(\\n str(DB_PATH),\\n hdrs=(SortableJS('.sortable'), Theme.blue.headers()),\\n live=False,\\n **table_config\\n)```\"\n", "},\n", " \"1346279322775720039\": {\n", " \"title\": \"Claudette Agent Exploration\",\n", " \"description\": \"An exploration of Claudette for understanding how LLMs can be used as agents\",\n", " \"key_features\": [\n", " \"SolveIt integration with Claudette\",\n", " \"LLM agent implementation\",\n", " \"GitHub Gist documentation\"\n", " ],\n", " \"author\": \"giordafrancis\",\n", " \"created_at\": \"2025-03-04T00:33:23.210000+00:00\",\n", " \"urls\": [\n", " \"https://gist.github.com/giordafrancis/8669e32ea73354ccc8844f31910aaaa8\"\n", " ],\n", " \"created_by_author\": true,\n", " \"content\": \"sharing my Claudette exploration using SolveIt. https://gist.github.com/giordafrancis/8669e32ea73354ccc8844f31910aaaa8 \\nI've never used Claudette before, but I found it extremely convenient to understand how llms can be used as agents. This concept appeared really complex prior to lessons and SolveIt, but it is now really more approachable for me.\"\n", "}\n", "}\n"]}], "execution_count": null}], "metadata": {"kernelspec": {"display_name": "python3", "language": "python", "name": "python3"}}, "nbformat": 4, "nbformat_minor": 4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment