""" Automation templates for workflow definitions. Contains predefined workflow templates that can be used to create automation definitions. """ from typing import Dict, Any, List # Automation templates structure AUTOMATION_TEMPLATES: Dict[str, Any] = { "sets": [ { "template": { "overview": "SharePoint Themen Zusammenfassung", "tasks": [ { "id": "Task01", "title": "SharePoint Themen Zusammenfassung", "description": "Erstellt eine Zusammenfassung aller SharePoint Sites und deren Inhalte", "objective": "Erstelle eine Zusammenfassung aller SharePoint Themen (Sites) und deren Inhalte als Word-Dokument", "actionList": [ { "execMethod": "sharepoint", "execAction": "findDocumentPath", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "searchQuery": "*", "maxResults": 100 }, "execResultLabel": "sharepoint_sites_found" }, { "execMethod": "sharepoint", "execAction": "listDocuments", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "pathQuery": "{{KEY:sharepointBasePath}}", "includeSubfolders": True }, "execResultLabel": "sharepoint_structure" }, { "execMethod": "ai", "execAction": "process", "execParameters": { "aiPrompt": "{{KEY:summaryPrompt}}", "documentList": ["sharepoint_sites_found", "sharepoint_structure"], "resultType": "docx" }, "execResultLabel": "sharepoint_summary" }, { "execMethod": "sharepoint", "execAction": "uploadDocument", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "documentList": ["sharepoint_summary"], "pathQuery": "{{KEY:sharepointFolderNameDestination}}" }, "execResultLabel": "sharepoint_upload_result" } ] } ] }, "parameters": { "connectionName": "connection:msft:p.motsch@valueon.ch", "sharepointBasePath": "/sites/company-share", "sharepointFolderNameDestination": "/sites/company-share/Freigegebene Dokumente/15. Persoenliche Ordner/Patrick Motsch/output", "summaryPrompt": "Erstelle eine umfassende Zusammenfassung aller SharePoint Sites und deren Inhalte. Strukturiere das Dokument nach Sites und fasse für jede Site die wichtigsten Themen, Ordnerstrukturen und Dokumente zusammen. Erstelle ein professionelles Word-Dokument mit Überschriften, Abschnitten und einer klaren Gliederung. Berücksichtige alle gefundenen Sites, deren Ordnerstrukturen und dokumentiere die wichtigsten Inhalte pro Site." } }, { "template": { "overview": "Immobilienrecherche Zürich", "tasks": [ { "id": "Task02", "title": "Immobilienrecherche Zürich", "description": "Webrecherche nach Immobilien im Kanton Zürich und Speicherung in Excel", "objective": "Immobilienrecherche im Kanton Zürich zum Verkauf (5-20 Mio. CHF) und speichere Ergebnisse in Excel-Liste auf SharePoint", "actionList": [ { "execMethod": "ai", "execAction": "webResearch", "execParameters": { "prompt": "{{KEY:immobilienResearchPrompt}}", "urlList": ["{{KEY:immobilienResearchUrl}}"] }, "execResultLabel": "immobilien_research_results" }, { "execMethod": "ai", "execAction": "process", "execParameters": { "aiPrompt": "{{KEY:excelFormatPrompt}}", "documentList": ["immobilien_research_results"], "resultType": "xlsx" }, "execResultLabel": "immobilien_excel_list" }, { "execMethod": "sharepoint", "execAction": "uploadDocument", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "documentList": ["immobilien_excel_list"], "pathQuery": "{{KEY:sharepointFolderNameDestination}}" }, "execResultLabel": "immobilien_upload_result" } ] } ] }, "parameters": { "connectionName": "connection:msft:p.motsch@valueon.ch", "sharepointFolderNameDestination": "/sites/company-share/Freigegebene Dokumente/15. Persoenliche Ordner/Patrick Motsch/output", "immobilienResearchUrl": ["https://www.homegate.ch", "https://www.immoscout24.ch", "https://www.immowelt.ch"], "immobilienResearchPrompt": "Suche nach Immobilien zum Verkauf im Kanton Zürich, Schweiz, im Preisbereich von 5-20 Millionen CHF. Sammle Informationen zu: Ort, Preis, Beschreibung, URL zu Bildern, Verkäufer/Kontaktinformationen.", "excelFormatPrompt": "Erstelle eine Excel-Datei mit den recherchierten Immobilien. Jede Immobilie soll eine Zeile sein mit den folgenden Spalten: Ort, Preis (in CHF), Beschreibung, URL zu Bild, Verkäufer. Verwende die Daten aus der Webrecherche." } }, { "template": { "overview": "Spesenbelege Zusammenfassung", "tasks": [ { "id": "Task03", "title": "Spesenbelege CSV Zusammenfassung", "description": "Liest PDF-Spesenbelege aus SharePoint-Ordner und erstellt CSV-Zusammenfassung", "objective": "Extrahiere alle PDF-Spesenbelege aus einem SharePoint-Ordner und erstelle eine CSV-Datei mit allen Spesendaten im selben Ordner", "actionList": [ { "execMethod": "sharepoint", "execAction": "findDocumentPath", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "searchQuery": "{{KEY:sharepointFolderNameSource}}:files:.pdf", "maxResults": 100 }, "execResultLabel": "sharepoint_pdf_files" }, { "execMethod": "sharepoint", "execAction": "readDocuments", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "pathObject": "sharepoint_pdf_files" }, "execResultLabel": "spesenbelege_documents" }, { "execMethod": "ai", "execAction": "process", "execParameters": { "aiPrompt": "{{KEY:expenseExtractionPrompt}}", "documentList": ["spesenbelege_documents"], "resultType": "csv" }, "execResultLabel": "spesenbelege_csv" }, { "execMethod": "sharepoint", "execAction": "uploadDocument", "execParameters": { "connectionReference": "{{KEY:connectionName}}", "documentList": ["spesenbelege_csv"], "pathQuery": "{{KEY:sharepointFolderNameDestination}}" }, "execResultLabel": "spesenbelege_upload_result" } ] } ] }, "parameters": { "connectionName": "connection:msft:p.motsch@valueon.ch", "sharepointFolderNameSource": "/sites/company-share/Freigegebene Dokumente/15. Persoenliche Ordner/Patrick Motsch/expenses", "sharepointFolderNameDestination": "/sites/company-share/Freigegebene Dokumente/15. Persoenliche Ordner/Patrick Motsch/output", "expenseExtractionPrompt": "Verarbeite alle bereitgestellten Dokumente, aber extrahiere nur Daten aus PDF-Spesenbelegen (ignoriere andere Dateitypen). Für jeden gefundenen PDF-Spesenbeleg extrahiere als separaten Datensatz: Datum, Betrag, MWST %, Währung, Kategorie, Beschreibung, Rechnungsnummer, Händler/Verkäufer, Steuerbetrag. Erstelle eine CSV-Datei mit einer Zeile pro Spesenbeleg. Verwende die folgenden Spaltenüberschriften: Datum, Betrag, Währung, Kategorie, Beschreibung, Rechnungsnummer, Händler, Steuerbetrag. Stelle sicher, dass alle Beträge numerisch sind und Datumswerte im Format YYYY-MM-DD vorliegen. Wenn ein Dokument kein Spesenbeleg ist, ignoriere es." } }, { "template": { "overview": "Preprocessing Server Data Update", "tasks": [ { "id": "Task04", "title": "Trigger Preprocessing Server", "description": "Triggers the preprocessing server at customer tenant to update database with configuration", "objective": "Call preprocessing server endpoint to update database with provided configuration JSON", "actionList": [ { "execMethod": "context", "execAction": "triggerPreprocessingServer", "execParameters": { "endpoint": "{{KEY:endpoint}}", "configJson": "{{KEY:configJson}}", "authSecretConfigKey": "{{KEY:authSecretConfigKey}}" }, "execResultLabel": "preprocessing_server_result" } ] } ] }, "parameters": { "endpoint": "https://poweron-althaus-preprocess-prod-e3fegaatc7faency.switzerlandnorth-01.azurewebsites.net/api/v1/dataprocessor/update-db-with-config", "authSecretConfigKey": "PREPROCESS_ALTHAUS_CHAT_SECRET", "configJson": "{\"tables\":[{\"name\":\"Artikel\",\"powerbi_table_name\":\"Artikel\",\"steps\":[{\"keep\":{\"columns\":[\"I_ID\",\"Artikelbeschrieb\",\"Artikelbezeichnung\",\"Artikelgruppe\",\"Artikelkategorie\",\"Artikelkürzel\",\"Artikelnummer\",\"Einheit\",\"Gesperrt\",\"Keywords\",\"Lieferant\",\"Warengruppe\"]}},{\"fillna\":{\"column\":\"Lieferant\",\"value\":\"Unbekannt\"}}]},{\"name\":\"Einkaufspreis\",\"powerbi_table_name\":\"Einkaufspreis\",\"steps\":[{\"to_numeric\":{\"column\":\"EP_CHF\",\"errors\":\"coerce\"}},{\"dropna\":{\"subset\":[\"EP_CHF\"]}}]}]}" } }, { "template": { "overview": "JIRA to SharePoint Ticket Synchronization", "tasks": [ { "id": "Task01", "title": "Sync JIRA Tickets to SharePoint", "description": "Export JIRA tickets, merge with SharePoint file, upload back, and import changes to JIRA", "objective": "Synchronize JIRA tickets with SharePoint file (bidirectional sync)", "actionList": [ { "execMethod": "sharepoint", "execAction": "findSiteByUrl", "execParameters": { "connectionReference": "{{KEY:sharepointConnection}}", "hostname": "{{KEY:sharepointHostname}}", "sitePath": "{{KEY:sharepointSitePath}}" }, "execResultLabel": "sharepoint_site" }, { "execMethod": "jira", "execAction": "connectJira", "execParameters": { "apiUsername": "{{KEY:jiraUsername}}", "apiTokenConfigKey": "{{KEY:jiraTokenConfigKey}}", "apiUrl": "{{KEY:jiraUrl}}", "projectCode": "{{KEY:jiraProjectCode}}", "issueType": "{{KEY:jiraIssueType}}", "taskSyncDefinition": "{{KEY:taskSyncDefinition}}" }, "execResultLabel": "jira_connection" }, { "execMethod": "jira", "execAction": "exportTicketsAsJson", "execParameters": { "connectionId": "jira_connection", "taskSyncDefinition": "{{KEY:taskSyncDefinition}}" }, "execResultLabel": "jira_exported_tickets" }, { "execMethod": "sharepoint", "execAction": "downloadFileByPath", "execParameters": { "connectionReference": "{{KEY:sharepointConnection}}", "siteId": "sharepoint_site", "filePath": "{{KEY:sharepointMainFolder}}/{{KEY:syncFileName}}" }, "execResultLabel": "existing_file_content" }, { "execMethod": "jira", "execAction": "parseExcelContent", "execParameters": { "excelContent": "existing_file_content", "skipRows": 3, "hasCustomHeaders": True }, "execResultLabel": "existing_parsed_data" }, { "execMethod": "jira", "execAction": "mergeTicketData", "execParameters": { "jiraData": "jira_exported_tickets", "existingData": "existing_parsed_data", "taskSyncDefinition": "{{KEY:taskSyncDefinition}}", "idField": "ID" }, "execResultLabel": "merged_ticket_data" }, { "execMethod": "sharepoint", "execAction": "copyFile", "execParameters": { "connectionReference": "{{KEY:sharepointConnection}}", "siteId": "sharepoint_site", "sourceFolder": "{{KEY:sharepointMainFolder}}", "sourceFile": "{{KEY:syncFileName}}", "destFolder": "{{KEY:sharepointBackupFolder}}", "destFile": "backup_{{TIMESTAMP}}_{{KEY:syncFileName}}" }, "execResultLabel": "file_backup" }, { "execMethod": "jira", "execAction": "createExcelContent", "execParameters": { "data": "merged_ticket_data", "headers": "existing_parsed_data", "taskSyncDefinition": "{{KEY:taskSyncDefinition}}" }, "execResultLabel": "new_file_content" }, { "execMethod": "sharepoint", "execAction": "uploadFile", "execParameters": { "connectionReference": "{{KEY:sharepointConnection}}", "siteId": "sharepoint_site", "folderPath": "{{KEY:sharepointMainFolder}}", "fileName": "{{KEY:syncFileName}}", "content": "new_file_content" }, "execResultLabel": "uploaded_file" }, { "execMethod": "sharepoint", "execAction": "downloadFileByPath", "execParameters": { "connectionReference": "{{KEY:sharepointConnection}}", "siteId": "sharepoint_site", "filePath": "{{KEY:sharepointMainFolder}}/{{KEY:syncFileName}}" }, "execResultLabel": "uploaded_file_content" }, { "execMethod": "jira", "execAction": "parseExcelContent", "execParameters": { "excelContent": "uploaded_file_content", "skipRows": 3, "hasCustomHeaders": True }, "execResultLabel": "import_data" }, { "execMethod": "jira", "execAction": "importTicketsFromJson", "execParameters": { "connectionId": "jira_connection", "ticketData": "import_data", "taskSyncDefinition": "{{KEY:taskSyncDefinition}}" }, "execResultLabel": "import_result" } ] } ] }, "parameters": { "sharepointConnection": "connection:msft:patrick.motsch@delta.ch", "sharepointHostname": "deltasecurityag.sharepoint.com", "sharepointSitePath": "SteeringBPM", "sharepointMainFolder": "/General/50 Docs hosted by SELISE", "sharepointBackupFolder": "/General/50 Docs hosted by SELISE/SyncHistory", "syncFileName": "DELTAgroup x SELISE Ticket Exchange List.xlsx", "jiraUsername": "p.motsch@valueon.ch", "jiraTokenConfigKey": "Feature_SyncDelta_JIRA_DELTA_TOKEN_SECRET", "jiraUrl": "https://deltasecurity.atlassian.net", "jiraProjectCode": "DCS", "jiraIssueType": "Task", "taskSyncDefinition": "{\"ID\":[\"get\",[\"key\"]],\"Module Category\":[\"get\",[\"fields\",\"customfield_10058\",\"value\"]],\"Summary\":[\"get\",[\"fields\",\"summary\"]],\"Description\":[\"get\",[\"fields\",\"description\"]],\"References\":[\"get\",[\"fields\",\"customfield_10066\"]],\"Priority\":[\"get\",[\"fields\",\"priority\",\"name\"]],\"Issue Status\":[\"get\",[\"fields\",\"status\",\"name\"]],\"Assignee\":[\"get\",[\"fields\",\"assignee\",\"displayName\"]],\"Issue Created\":[\"get\",[\"fields\",\"created\"]],\"Due Date\":[\"get\",[\"fields\",\"duedate\"]],\"DELTA Comments\":[\"get\",[\"fields\",\"customfield_10167\"]],\"SELISE Ticket References\":[\"put\",[\"fields\",\"customfield_10067\"]],\"SELISE Status Values\":[\"put\",[\"fields\",\"customfield_10065\"]],\"SELISE Comments\":[\"put\",[\"fields\",\"customfield_10168\"]]}" } } ] } def getAutomationTemplates() -> Dict[str, Any]: """ Get automation templates. Returns: Dict containing the automation templates structure with 'sets' key. """ return AUTOMATION_TEMPLATES