Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Local environment and secrets
.env

# Local root development copy
/app/

# Python cache
__pycache__/
*.pyc

# Local test/output files
output/
approval_body.json
chat_body.json
hitl_body.json
export_test.docx
sample_grant_missing_collaborator/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.env
__pycache__/
*.pyc
output/
approval_body.json
chat_body.json
hitl_body.json
28 changes: 28 additions & 0 deletions use-cases/Anirudh7S/research-grant-packet-assembler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SuperDocs Builds

Community builds: apps, integrations and extensions built on the [SuperDocs](https://superdocs.app) platform.

SuperDocs is an AI document editor that works inside the document, not next to it. It ships as a free web app, a REST API, and an MCP server that lets AI agents read and edit documents on their own. Everything in this repository is built on that public surface.

## What lives here

| Folder | What belongs in it |
|---|---|
| [`use-cases/`](use-cases/) | Apps and end-to-end use cases: vertical tools, document workflows, demos that solve a real problem for a real kind of user |
| [`extensions/`](extensions/) | Extensions and developer tooling: editor integrations, plugins, CLIs, SDK wrappers, agent pipelines, anything that extends where SuperDocs can run |

Every project is self-contained in its builder's own folder and carries its own README.

## Contributing

Fork the repo, build in your own folder, open a pull request. The full mechanics, including how to name your folder and what your PR description must include, are in [CONTRIBUTING.md](CONTRIBUTING.md).

## Useful links

- Product: [use.superdocs.app](https://use.superdocs.app)
- Developer documentation: [docs.superdocs.app](https://docs.superdocs.app)
- Contact: hello@superdocs.app

## License

MIT. Every contribution stays publicly credited to its author, permanently.
Empty file.
240 changes: 240 additions & 0 deletions use-cases/Anirudh7S/research-grant-packet-assembler/app/assemble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
from typing import Any, Dict, List


def find_document(
documents: List[Dict[str, Any]],
document_type: str,
) -> Dict[str, Any]:
"""Find the first document matching a document type."""

for document in documents:
if document["document_type"] == document_type:
return document

return {}


def build_grant_package(
extracted_documents: List[Dict[str, Any]],
) -> Dict[str, Any]:
"""Assemble extracted grant facts into one structured package."""

research = find_document(
extracted_documents,
"research_narrative",
)

data_management = find_document(
extracted_documents,
"data_management_plan",
)

facilities = find_document(
extracted_documents,
"facilities_statement",
)

budget = find_document(
extracted_documents,
"budget_justification",
)

investigator_documents = [
document
for document in extracted_documents
if document["document_type"] == "investigator_cv"
]

research_facts = research.get("facts", {})
dmp_facts = data_management.get("facts", {})
facilities_facts = facilities.get("facts", {})
budget_facts = budget.get("facts", {})

investigators = []

for document in investigator_documents:
facts = document.get("facts", {})

investigators.append(
{
"filename": document["filename"],
"name": facts.get("name", ""),
"current_position": facts.get(
"current_position",
"",
),
"education": facts.get(
"education",
[],
),
"research_interests": facts.get(
"research_interests",
[],
),
"professional_experience": facts.get(
"professional_experience",
[],
),
"selected_publications": facts.get(
"selected_publications",
[],
),
"awards": facts.get(
"awards",
[],
),
"current_grant_role": facts.get(
"current_grant_role",
"",
),
}
)

grant_package = {
"project": {
"title": research_facts.get(
"project_title",
"",
),
"principal_investigator": research_facts.get(
"principal_investigator",
"",
),
"co_investigator": research_facts.get(
"co_investigator",
"",
),
},

"research_narrative": {
"project_summary": research_facts.get(
"project_summary",
"",
),
"specific_aims": research_facts.get(
"specific_aims",
[],
),
"research_approach": research_facts.get(
"research_approach",
"",
),
"expected_outcomes": research_facts.get(
"expected_outcomes",
"",
),
"significance": research_facts.get(
"significance",
"",
),
},

"data_management_plan": {
"project": dmp_facts.get(
"project",
"",
),
"principal_investigator": dmp_facts.get(
"principal_investigator",
"",
),
"co_investigator": dmp_facts.get(
"co_investigator",
"",
),
"data_types": dmp_facts.get(
"data_types",
"",
),
"data_collection": dmp_facts.get(
"data_collection",
"",
),
"data_storage": dmp_facts.get(
"data_storage",
"",
),
"data_security": dmp_facts.get(
"data_security",
"",
),
"data_quality": dmp_facts.get(
"data_quality",
"",
),
"data_sharing": dmp_facts.get(
"data_sharing",
"",
),
"data_retention": dmp_facts.get(
"data_retention",
"",
),
},

"investigators": investigators,

"facilities_statement": {
"project": facilities_facts.get(
"project",
"",
),
"facilities_and_sites": facilities_facts.get(
"facilities_and_sites",
"",
),
"space_and_screening": facilities_facts.get(
"space_and_screening",
"",
),
"data_systems": facilities_facts.get(
"data_systems",
"",
),
"institutional_support": facilities_facts.get(
"institutional_support",
"",
),
"investigator_responsibilities": facilities_facts.get(
"investigator_responsibilities",
"",
),
},

"budget_justification": {
"personnel": budget_facts.get(
"personnel",
"",
),
"principal_investigator": budget_facts.get(
"principal_investigator",
"",
),
"co_investigator": budget_facts.get(
"co_investigator",
"",
),
"participant_and_site_activities": budget_facts.get(
"participant_and_site_activities",
"",
),
"data_management": budget_facts.get(
"data_management",
"",
),
"dissemination": budget_facts.get(
"dissemination",
"",
),
},

"source_documents": [
{
"filename": document["filename"],
"document_type": document["document_type"],
}
for document in extracted_documents
],
}

return grant_package
Loading