MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / generate_fda_guidance_draft

Function generate_fda_guidance_draft

scripts/generate_content_pr.py:124–204  ·  view source on GitHub ↗

Generate EN and ZH draft Markdown for FDA guidance updates.

(update: dict)

Source from the content-addressed store, hash-verified

122
123
124def generate_fda_guidance_draft(update: dict) -> tuple[str, str]:
125 """Generate EN and ZH draft Markdown for FDA guidance updates."""
126 name = update.get("name", "Unknown Source")
127 url = update.get("url", "")
128 detected_at = update.get("detected_at", datetime.now().isoformat())[:10]
129 new_items = update.get("new_items", [])
130
131 items_en = ""
132 items_zh = ""
133 for item in new_items[:10]:
134 title = item.get("title", "")
135 link = item.get("link", "")
136 pub_date = item.get("pub_date", "")[:10] if item.get("pub_date") else ""
137 if link:
138 items_en += f"| [{title}]({link}) | {pub_date} |\n"
139 items_zh += f"| [{title}]({link}) | {pub_date} |\n"
140 else:
141 items_en += f"| {title} | {pub_date} |\n"
142 items_zh += f"| {title} | {pub_date} |\n"
143
144 fallback_en = "| See source URL for details | - |\n"
145 fallback_zh = "| 请查看来源链接了解详情 | - |\n"
146 items_en_block = items_en if items_en else fallback_en
147 items_zh_block = items_zh if items_zh else fallback_zh
148
149 en_content = f"""---
150title: FDA Guidance Updates ({detected_at})
151draft: true
152source: {url}
153detected_at: {detected_at}
154---
155
156# FDA Guidance Updates
157
158> **Draft**: Auto-generated from update detection. Requires human review before merging.
159
160New FDA guidance documents detected from [{name}]({url}).
161
162## Detected Updates
163
164| Guidance | Date |
165|----------|------|
166{items_en_block}
167::: tip Source
168[FDA Standards Database](https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfStandards/search.cfm)
169:::
170
171::: warning Review Required
172This draft was auto-generated. Please verify content accuracy and update
173the relevant docs pages (e.g., `docs/en/fda/guidance.md`) before merging.
174:::
175"""
176
177 zh_content = f"""---
178title: FDA 指导文件更新 ({detected_at})
179draft: true
180source: {url}
181detected_at: {detected_at}

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected