Core V.E.T.S. Procedures
Overview
These core procedures form the backbone of V.E.T.S. functionality, handling everything from user authentication and dashboard generation to animal management, veterinary operations, and AI content generation. Understanding these procedures is essential for developers extending or maintaining the V.E.T.S. platform.
Procedure Inventory
| Category | Count | Prefix |
| Application Stored Procedures | 1,478 | astp_ |
| System Stored Procedures | 1,098 | sstp_ |
| HTML Generation Functions | 24+ | afnc_HTML_ |
| Mobile UI Procedures | 229+ | *Mobile* |
| Total Documented Here | 150+ Core Procedures |
Key Characteristics
- Stored Procedure-Driven UI: All HTML is generated server-side in SQL procedures
- Mobile-Responsive: Automatic detection and optimization via
@isMobileDevice parameter
- Permission-Aware: Built-in security enforced at HTML generation level
- AJAX-First: No page refreshes - all interactions via asynchronous calls
- Multi-Tenant: Secure isolation between organizations via Domain filtering
- API-Ready: Procedure names will map directly to future API endpoints
Future Direction: Procedures → APIs
Many of these procedures will become REST APIs. The API endpoints will be dynamically named based on the stored procedure names, creating a direct mapping between database logic and web services. For example:
| Procedure | Future API |
astp_VETS_TeamDoc_Tasks_CreateAnimalTask | /api/VETS/TeamDoc/Tasks/CreateAnimalTask |
sstp_TeamDoc_Inputs_SaveInput | /api/TeamDoc/Inputs/SaveInput |
astp_AI_GetTeamDocRef | /api/AI/GetTeamDocRef |
Procedure names are designed with this future API surface in mind. Names may change as APIs are developed.
How to Use This Reference
Procedures are organized by category with collapsible sections. Each category shows:
- Execution Count: Procedures ranked by actual usage (since last server restart)
- Detailed Documentation: High-priority procedures documented in full
- Quick Reference: Lower-priority procedures listed for completeness
Click any section header to expand/collapse the content.
🔐 Authentication & Security
Execution Priority: CRITICAL - These procedures handle every user interaction
📊 High-Priority Procedures (by execution count)
sstp_Teamdoc_WebsitesGetWebsite
Executions: 365,451 | Priority: HIGHEST
Purpose
Gets website configuration by URL. Called on every page load to determine site settings, layout, and permissions.
Key Outputs
- Website PrimKey and configuration
- Layout reference for master page selection
- CSS and branding settings
sstp_Database_VerifyDDLActionPermission
Executions: 64,257
Purpose
Validates DDL (Data Definition Language) permissions before schema operations. Security checkpoint for administrative actions.
astp_VETS_TeamDoc_SetReaderRightsForCurrentUser
Executions: 32,506
Purpose
Automatically grants reader permissions to the current user for TeamDoc documents they should have access to.
sstp_TeamDoc_TeamDocPermissions_GrantAccess
Executions: 28,532
Purpose
Grants TeamDoc permissions (Reader/Editor/Manager) to users or groups.
Parameters
@TeamDocRef - Document identifier
@LoginOrGroup - User login or group name
@PermissionLevel - Reader, Editor, or Manager
sstp_TeamDoc_TeamDocPermissions_RevokeAccess
Executions: 27,040
Purpose
Revokes previously granted TeamDoc permissions.
sstp_System_Authenticate
Executions: 8,732
Purpose
Core user authentication procedure. Validates credentials and establishes session.
astp_SocialMedia_Admin_AuthenticatedNowMobile
Priority: HIGH | Main dashboard after login
Purpose
Main authenticated dashboard and menu generation after user login. This is the first procedure called after authentication and sets up the entire user interface.
Key Parameters
@PrimKeyRawXML - XML containing selected animal primary keys for bulk operations
@ClientHistorySearch - Client search mode flag
@AnimalHistorySearch - Animal search mode flag
@PIMSLogin - Current user login name
@SocialMediaLogin - Social authentication identifier (OneAll)
@ViewDeceasedAlso - Include deceased animals flag
@isMobileDevice - Device type for responsive generation
@inHospital - Hospital status filter
@availHeight - Available screen height for layout
📋 Additional Authentication Procedures
| Procedure | Purpose |
astp_SocialMedia_Admin_AuthenticatedNow | Non-mobile dashboard generation |
astp_SocialMedia_Admin_AuthenticateActivate | Account activation flow |
astp_Security_AutoLoginGUIDPassDELETE | Clean up auto-login tokens |
sstp_Security_Maintenance_CleanUp | Security maintenance tasks |
sstp_Security_Maintenance_RevokeExpiredUsers | Expire inactive accounts |
sstp_TeamDoc_TeamDocPermissions_GetPermissions | Retrieve current permissions |
📓 Item & Tree Management
Core procedures for managing items, tree lists, and their TeamDoc integration
⭐ Critical HTML Functions
afnc_HTML_AuthenticatedNow1Animal0 & afnc_HTML_AuthenticatedNow1Animal1
Priority: CRITICAL | The animal card generation engine
Purpose
These two functions are the core HTML generation engine for animal "cards" - the visual representation of animals throughout the V.E.T.S. interface. They work as a pair:
- afnc_HTML_AuthenticatedNow1Animal0: Generates the outer container and layout
- afnc_HTML_AuthenticatedNow1Animal1: Generates the inner content and details
Key Parameters
@AnimalRef - Animal being displayed
@ClientPrimKey - Owner reference
@isMobileDevice - Device size (0-100+) for responsive sizing
@ColorCode - Color scheme selection (0-4)
@ViewDeceasedAlso - Include deceased animals
@inHospital - Hospital status filter
Device Size Codes (@isMobileDevice)
| Value | Device Type | Sizing |
| 0 | Desktop (full size) | 100% width, large fonts |
| 1 | Large tablet | 730px width |
| 2 | Small tablet | 500px width, 20px fonts |
| 3 | Large phone | Compact layout |
| 4 | Medium phone | Further reduced |
| 5 | Small phone | Minimal layout |
| 11 | Very small/compact | Ultra-compact |
| 15 | Wide tablet | Special wide format |
| >50 | Scaled/thumbnail | Thumbnail view |
Color Coding System (@ColorCode)
| Code | Logic | Colors |
| 0 | Location Status | Cyan=Home, Pink=Hospital, Gray=Away |
| 1 | Herd-Based | Gradient from HerdRef GUID |
| 2 | Species-Based | Colors per species |
| 3 | Sex-Based | Colors per sex |
| 4 | Custom | Application-specific |
Calling Procedures (14+)
These functions are called by multiple procedures:
astp_SocialMedia_Admin_AuthenticatedNowMobileAnimalGrid
sstp_TeamDoc_Inputs_GetComments
astp_VETS_Animals_PedigreeTreeMobile
astp_VETS_TeamDoc_CreateDoc_PatientHistoryVisitsBuildSub0/1
sstp_Teamdoc_WebsiteGetHerdEditMenuMobile
- Multiple reporting views (
arpt_Items_*)
📊 High-Priority Item/Tree Procedures
astp_Items_TreeList_EditTreeOrItemTeamDoc2
Executions: 2,063 | AI Integration Point
Purpose
Generates edit forms for items and tree values with AI integration. This is the primary interface for content editing and includes the AI content generation features.
Key Features
- 🎯 AI Integration Point: Shows AI icon in upper left of edit forms
- 📝 Context-Aware Forms: Different UI based on TransactionType
- Color-Coded Backgrounds: Visual categorization by service type
- Mobile-Responsive: Optimized layouts for all devices
- Permission-Aware: Only shows fields user can edit
Color Coding by TransactionType
| TransactionType | Background |
| ClientAppointmentServices | Light Green |
| RX | Tan |
| VA | Pink |
| DEA | Yellow |
astp_Items_TreeList_ViewTreeOrItemTeamDoc2
Purpose
Generates TeamDoc viewer iframe for items and tree values. Creates the interface for viewing documentation and automatically assigns permissions.
TreeListType Normalization
-- Legacy code mapping
IF @TreeListType IN ('IM', 'Tran', 'TX', 'AN', 'Chiro', 'DG', 'DP', ...)
SET @TreeListType = 'ProfessionalServices'
IF @TreeListType IN ('Rx', 'DEA', 'NonRx')
SET @TreeListType = 'RxProducts'
Automatic Permission Assignment
- Status Reporting - RO: Reader access
- VETS [TreeListType] Doc Editor: Editor access
- VETS Veterinarians: Editor access
- Developers: Manager access
astp_Items_TreeList_GetByTreeListTypeandAnimalRefMobile
Executions: 542
Purpose
Retrieves and displays tree list items filtered by type and animal, optimized for mobile interfaces.
📋 Additional Item/Tree Procedures
| Procedure | Purpose |
astp_Items_TreeList_AddTreeOrItemTeamDoc | Add new TeamDoc for item/tree |
astp_Items_TreeList_EditTreeOrItemTeamDoc | Edit TeamDoc (legacy) |
astp_Items_TreeList_GetRelatedNodes | Get related tree nodes |
astp_Items_TreeList_GetServiceItemsBySpeciesandFilter | Species-filtered services |
astp_Items_TreeList_GetByTreeListTypeandClientRef | Client-filtered tree items |
astp_Items_TreeList_GetByTreeListTypeandHerdRef | Herd-filtered tree items |
astp_Items_TreeList_GetClientAppointmentServicesMobile | Client appointment services |
astp_Items_TreeList_INSERT | Insert new tree list item |
astp_Items_TreeListItems_INSERT | Insert item into tree |
astp_Items_TreeListItems_DELETE | Remove item from tree |
astp_Items_Items_isretaskable | Check if item can be retasked |
astp_Items_Tree_GetDefaultViewByHost | Default tree view by host |
astp_Items_TeamDocWebsite_Store_GetKitChildren | Get kit child items |
🏥 Website & Menu Generation
Highest execution counts - these procedures render every page view
📊 Website Rendering (Highest Priority)
sstp_TeamDoc_WebsiteGetWebPagesBasedOnSetAs
Executions: 57,434
Purpose
Retrieves webpages based on their SetAs flag (Featured, Homepage, etc.). Core to navigation and content discovery.
sstp_Teamdoc_WebsiteGetSubjectPage
Executions: 43,788
Purpose
Gets subject/section page content for display.
sstp_Teamdoc_WebsiteGetLeftMenuWebPages1
Executions: 26,108
Purpose
Generates left navigation menu with webpage links.
sstp_Teamdoc_WebsiteGetSectionPage
Executions: 26,108
Purpose
Retrieves section page content.
sstp_Teamdoc_WebsitesGetWebsiteLayout
Executions: 22,056
Purpose
Gets website layout configuration for master page selection.
sstp_TeamDoc_WebsiteGetAddressBarIcon
Executions: 11,183
Purpose
Retrieves favicon/address bar icon for the website.
sstp_TeamDoc_WebSitesGetFooterWebPages
Executions: 11,116
Purpose
Gets footer navigation webpage links.
sstp_Teamdoc_WebsiteGetLeftMenuLinks
Executions: 10,864
Purpose
Generates left menu navigation links.
sstp_TeamDoc_WebsiteGetWebPage
Executions: 9,666
Purpose
Retrieves single webpage content by identifier.
📱 Mobile Menu Generation
sstp_Teamdoc_WebsiteGetVeterinaryMenuMobile
Executions: 208 | CPU: 378,583ms total
Purpose
Generates the veterinary management menu for animal-specific operations. Main interface for veterinarians working with individual animals.
Components
- Animal Header: via
astp_VETS_NameHeader
- Media Upload: Direct access to file upload
- Video Gallery: via
astp_Media_GetVideoGallery
- Task Creation: Requires Editor/Manager permissions
sstp_Teamdoc_WebsiteGetAnimalEditMenuMobile
Purpose
Generates animal-specific edit menu with comprehensive media management.
Features
- Image Gallery: Shows recent images (last 24 hours) and sales images
- Video Gallery: Integrated video management
- Media Upload: Only for Editor/Manager permissions
sstp_Teamdoc_WebsiteGetClientEditMenuMobile
Purpose
Generates client/contact edit menu for mobile devices.
sstp_Teamdoc_WebsiteGetHerdEditMenuMobile
Purpose
Generates herd management menu for mobile devices.
📋 Additional Website Procedures
| Procedure | Executions | Purpose |
sstp_TeamDoc_WebsiteGetStoreFrontWebPage | 814 | Store front page |
sstp_TeamDoc_WebsiteGetFooterNav | 717 | Footer navigation |
sstp_TeamDoc_Inputs_GetWebPage | 418 | Get webpage input |
sstp_TeamDoc_WebsiteGetSubMenus | - | Submenu generation |
sstp_Teamdoc_WebsiteGetLeftMenuLinksMobile | 166 | Mobile left menu |
sstp_Teamdoc_WebsiteGetLeftMenuLinksMobile2 | 319 | Mobile left menu v2 |
sstp_Teamdoc_WebsiteOpenWebPageMobile | 273 | Open page on mobile |
sstp_Teamdoc_WebsiteOpenStoreMobile | - | Open store on mobile |
sstp_Teamdoc_WebsiteOpenRoughstockBrokerMobile | 108 | Roughstock broker mobile |
sstp_Teamdoc_WebsiteViewItemMobile | - | View item on mobile |
sstp_TeamDoc_WebsiteInsertActivityLog | 286 | Log website activity |
sstp_TeamDocRef_WebsiteGetLogo | 3,632 | Get website logo |
astp_TeamDoc_Website_GetSettings | 405 | Get website settings |
✅ Task Management
30+ procedures for veterinary task workflow management
📊 Core Task Procedures
astp_VETS_TeamDoc_Tasks_EditTask1
Purpose
Generates comprehensive task edit forms with TeamDoc integration for veterinary and operational tasks.
Features
- Assignment: Task ownership management
- Scheduling: Due dates and priority settings
- Status Tracking: Progress and completion monitoring
- TeamDoc Integration: Document creation for task details
astp_VETS_TeamDoc_Tasks_CreateAnimalTask
Purpose
Creates new tasks linked to individual animals with automatic TeamDoc setup.
Process
- Create task record in database
- Associate with animal via
AnimalRef
- Create associated TeamDoc document
- Assign default access permissions
- Return edit form HTML
astp_VETS_TeamDoc_Tasks_CreateClientTask
Purpose
Creates tasks linked to clients/contacts.
astp_VETS_TeamDoc_Tasks_CreateHerdTask
Purpose
Creates tasks linked to herds for group operations.
astp_VETS_TeamDoc_Tasks_CreateVeterinaryTask
Purpose
Creates veterinary-specific tasks with medical workflow integration.
📋 Task Workflow Procedures
| Procedure | Purpose |
astp_VETS_TeamDoc_Tasks_StartTask | Start task timer/workflow |
astp_VETS_TeamDoc_Tasks_StopTask | Stop task timer |
astp_VETS_TeamDoc_Tasks_StartStop | Toggle start/stop state |
astp_VETS_TeamDoc_Tasks_CompleteTask | Mark task complete |
astp_VETS_TeamDoc_Tasks_UpdateProgress | Update completion percentage |
astp_VETS_TeamDoc_Tasks_UpdateTaskDueDate | Change due date |
astp_VETS_TeamDoc_Tasks_TaskList | Display task list |
astp_VETS_TeamDoc_Tasks_DeleteThread | Delete task thread |
astp_VETS_TeamDoc_Tasks_isretaskable | Check if task can be reassigned |
📋 Task Assignment Procedures
| Procedure | Purpose |
astp_VETS_TeamDoc_Tasks_ResponsibleEdit | Edit responsible party |
astp_VETS_TeamDoc_Tasks_UpdateResponsible | Update responsible party |
astp_VETS_TeamDoc_Tasks_ViewResponsibleDropdown | Responsible selection dropdown |
astp_VETS_TeamDoc_Tasks_UpdateAssignedToByGroup | Assign to group |
astp_VETS_TeamDoc_Tasks_UpdateAssignedToByIndividual | Assign to individual |
astp_VETS_TeamDoc_Tasks_ViewAssignedToDropdownByGroup | Group assignment dropdown |
astp_VETS_TeamDoc_Tasks_ViewAssignedToDropdownByIndividual | Individual assignment dropdown |
astp_VETS_TeamDoc_Tasks_AuthorizedByEdit | Edit authorization |
astp_VETS_TeamDoc_Tasks_UpdateAuthorizedBy | Update authorization |
astp_VETS_TeamDoc_Tasks_ViewAuthorizedByDropdown | Authorization dropdown |
📋 Task Helper Procedures
| Procedure | Purpose |
astp_VETS_TeamDoc_Tasks_AnimalSelect | Animal selection for task |
astp_VETS_TeamDoc_Tasks_ClientSelect | Client selection for task |
astp_VETS_TeamDoc_Tasks_ClassifySelect | Task classification selection |
astp_VETS_TeamDoc_Tasks_LocationSelect | Location selection |
astp_VETS_TeamDoc_Tasks_GetImages | Get task images |
astp_VETS_TeamDoc_Tasks_Images | Task image management |
astp_VETS_TeamDoc_Tasks_GetLinkData | Get linked data |
astp_VETS_TeamDoc_Tasks_UpdateItemRefinTask | Update item reference |
astp_VETS_TeamDoc_Tasks_SearchBillTreeItem | Search billable items |
astp_VETS_TeamDoc_Tasks_TreeViewTaskTable | Tree view of tasks |
astp_VETS_TeamDoc_Tasks_CreateQuickNote | Quick note creation |
astp_VETS_TeamDoc_Tasks_QuickNoteAdd | Add quick note |
astp_VETS_TeamDoc_Tasks_CreateTaskAssociatedReminderMessage | Create reminder |
astp_VETS_TeamDoc_Tasks_CreatePatientHistoryAssociatedReminderMessage | Patient history reminder |
🐴 Animal Management
Core procedures for animal CRUD operations and display
📊 Primary Animal Procedures
sstp_Teamdoc_WebsiteAddEditAnimal
Priority: CRITICAL | Most frequently called form procedure
Purpose
Comprehensive animal add/edit form with tabbed interface. Handles both creating new animals and editing existing ones.
Tabbed Interface
| Tab | Purpose | Key Fields |
| Name | Basic identification | Name, Registration, Alias |
| Classification | Species, breed, category | Species, Breed, Color, Sex |
| Age/Weight | Physical characteristics | Birth date, Weight, Height |
| Comments | Additional notes | General comments, Notes |
| Sales/Ownership | Commercial information | Price, Owner, Transfer history |
Key Parameters
@AnimalRef - NULL for add, GUID for edit
@isWizard - Enable guided setup mode
@isMobileDevice - Device sizing
astp_SocialMedia_Admin_AuthenticatedNowMobileAnimalGrid
Purpose
Generates the main animal grid display showing animal cards. Uses afnc_HTML_AuthenticatedNow1Animal0/1 for card generation.
sstp_Teamdoc_WebsiteViewAnimalMobile
Purpose
View-only animal display for mobile devices.
astp_SocialMedia_Admin_AuthenticatedNowMobileHerdGrid
Purpose
Generates herd grid display showing herd cards.
astp_VETS_NameHeader
Executions: 559
Purpose
Generates animal name header display used across multiple interfaces.
📋 Additional Animal/Herd Procedures
| Procedure | Purpose |
sstp_Teamdoc_WebsiteAddEditHerd | Herd add/edit form |
sstp_Teamdoc_WebsiteAddEditContact | Contact add/edit form |
sstp_Teamdoc_WebsiteAddNewContact | New contact form |
sstp_Teamdoc_WebsiteAddNewClientMobile | New client mobile form |
sstp_Teamdoc_WebsiteAddEditOwnerMobile | Owner edit mobile form |
astp_SocialMedia_Admin_editHerdsinframe | Herd editing in iframe |
astp_SocialMedia_Admin_EditClientPermissions | Client permission editing |
astp_AnimalSales_GetPhotoAlbumContent | Animal photo album |
astp_AnimalSales_Tree_GetDefaultViewByHost | Animal sales tree view |
astp_VETS_Animals_PedigreeTreeMobile | Pedigree tree display |
📋 Animal TeamDoc Procedures
| Procedure | Executions | Purpose |
astp_VETS_TeamDoc_CreateDoc | 1,362 | Create animal TeamDoc |
astp_VETS_TeamDoc_CreateDocPermissions | 1,352 | Set animal TeamDoc permissions |
astp_VETS_TeamDoc_CreateDoc_Permissions | 1,352 | Permissions sub-procedure |
astp_VETS_TeamDoc_CreateDoc_Permissions_Herds | 1,270 | Herd-based permissions |
astp_VETS_TeamDoc_CreateDoc_Herd | 98 | Create herd TeamDoc |
astp_VETS_TeamDoc_CreateDoc_BackgroundSilentByPIMSLogin | 1,329 | Background TeamDoc creation |
📄 TeamDoc Input Management
150+ procedures for managing TeamDoc content - the core CMS system
📊 High-Priority Input Procedures (by execution)
sstp_TeamDoc_Inputs_GetUnreadInputs
Executions: 14,980
Purpose
Retrieves unread inputs for the current user. Powers notification badges and unread indicators.
sstp_TeamDoc_Inputs_GetTasksPanel
Executions: 14,114
Purpose
Generates the tasks panel display with task list and status indicators.
sstp_TeamDoc_Documents_GetDocument
Executions: 14,384
Purpose
Retrieves TeamDoc document by identifier with permission checking.
sstp_TeamDoc_Inputs_SaveInput
Executions: 7,569
Purpose
Base input creation procedure. All input types flow through this.
Key Parameters
@TeamDocRef - Parent document
@RootRef - Root element (REQUIRED)
@ParentRef - Immediate parent
@InputType - Type: Subject, Comment, Task, WebPage, etc.
@Title - Input title
@SortOrder - Display ordering
sstp_TeamDoc_Inputs_SaveInputSubject
Executions: 4,756
Purpose
Creates Subject (folder) inputs for organizing content hierarchically.
📋 Input Creation Procedures (12 types)
| Procedure | Input Type |
sstp_TeamDoc_Inputs_SaveInput | Base (all types) |
sstp_TeamDoc_Inputs_SaveInputSubject | Subject (folder) |
sstp_TeamDoc_Inputs_SaveInputTask | Task |
sstp_TeamDoc_Inputs_SaveInputWebPage | WebPage |
sstp_TeamDoc_Inputs_SaveInputChart | Chart |
sstp_TeamDoc_Inputs_SaveInputComment | Comment |
sstp_TeamDoc_Inputs_SaveInputFile | File |
sstp_TeamDoc_Inputs_SaveInputImage | Image |
sstp_TeamDoc_Inputs_SaveInputFileFolder | FileFolder |
sstp_TeamDoc_Inputs_SaveInputPhotoAlbum | PhotoAlbum |
sstp_TeamDoc_Inputs_SaveInputPoll | Poll |
sstp_TeamDoc_Inputs_SaveInputContactList | ContactList |
📋 Input Retrieval Procedures
| Procedure | Executions | Purpose |
sstp_TeamDoc_Inputs_GetInput | 122 | Get single input |
sstp_TeamDoc_Inputs_GetSubjects | 338 | Get subject folders |
sstp_TeamDoc_Inputs_GetComments | 337 | Get threaded comments |
sstp_TeamDoc_Inputs_GetTasks | 328 | Get tasks |
sstp_TeamDoc_Inputs_GetCharts | 329 | Get charts |
sstp_TeamDoc_Inputs_GetFiles | 328 | Get files |
sstp_TeamDoc_Inputs_GetImages | 328 | Get images |
sstp_TeamDoc_Inputs_GetFileFolder | 329 | Get file folders |
sstp_TeamDoc_Inputs_GetPhotoAlbum | 328 | Get photo albums |
sstp_TeamDoc_Inputs_GetPolls | 328 | Get polls |
sstp_TeamDoc_Inputs_GetContactLists | 328 | Get contact lists |
sstp_TeamDoc_Inputs_GetWebPage | 418 | Get webpage |
sstp_TeamDoc_Inputs_GetDBReports | 390 | Get DB reports |
sstp_TeamDoc_Inputs_GetTaskSummary | 328 | Task summary |
sstp_TeamDoc_Inputs_GetFilesPanel | 207 | Files panel |
sstp_TeamDoc_Inputs_GetRecentUpdates | 206 | Recent updates |
sstp_TeamDoc_Inputs_GetOutlineSubjects2 | 206 | Subject outline |
sstp_TeamDoc_Inputs_GetOutlineSections | 206 | Section outline |
📋 Input Modification Procedures
| Procedure | Purpose |
sstp_TeamDoc_Inputs_MoveInput | Move between parents |
sstp_TeamDoc_Inputs_CopyInput | Duplicate with sub-tables |
sstp_TeamDoc_Inputs_DeleteInput | Soft delete (sets Deleted) |
sstp_TeamDoc_Inputs_SetTaskStatus | Change task status |
sstp_TeamDoc_Inputs_SetTaskPriority | Change task priority |
sstp_TeamDoc_Inputs_SetTaskProgress | Update task progress |
sstp_TeamDoc_Inputs_TaskSearch | Search tasks |
📋 Document Management Procedures
| Procedure | Executions | Purpose |
sstp_TeamDoc_Documents_SaveDocument | 2,348 | Create/update document |
sstp_TeamDoc_Documents_GetUpdatedDocuments | 1,375 | Recently updated docs |
sstp_TeamDoc_Documents_UpdateLastRead | 339 | Update last read timestamp |
sstp_TeamDoc_RelatedDocuments_GetRelatedDocuments | 207 | Get related documents |
sstp_TeamDoc_UserAdmin_GetUser | 175 | Get TeamDoc user info |
🏥 Patient History System
71 specialized procedures - the ONLY hardcoded segmentation in V.E.T.S.
⚠️ Architecture Note
Patient History is the only place in V.E.T.S. that requires hardcoded segmentation. While the rest of the platform uses meta-architecture (everything through atbl_Items_Items), patient history needs specialized handling for different record types to produce human-readable medical records.
⭐ Central Orchestration Procedure
astp_VETS_PatientHistory_A_ProfessionalServicesParent
Priority: CRITICAL | The hub that orchestrates all patient history
Purpose
Central aggregation procedure that calls specialized sub-procedures based on record type. Manages the multi-step workflow for professional services.
Workflow Stages
- Step 1: Initial service selection and parent record creation
- Step 2: Child service addition and relationship management
- Step 3: Shopping cart integration and pricing
- Step 4: Patient history record completion
📊 GetRecord Procedures (14 types)
| Procedure | Record Type |
astp_VETS_PatientHistory_Accupuncture_GetRecord | Acupuncture |
astp_VETS_PatientHistory_Anesthesia_GetRecord | Anesthesia |
astp_VETS_PatientHistory_Certificates_GetRecord | Certificates |
astp_VETS_PatientHistory_Chiropractic_GetRecord | Chiropractic |
astp_VETS_PatientHistory_DentalProcedures_GetRecord | Dental |
astp_VETS_PatientHistory_DiagnosticImaging_GetRecord | X-ray/Ultrasound |
astp_VETS_PatientHistory_DiagnosticProcedures_GetRecord | Diagnostics |
astp_VETS_PatientHistory_Homeopathy_GetRecord | Homeopathy |
astp_VETS_PatientHistory_Identification_GetRecord | Microchip/Brand |
astp_VETS_PatientHistory_Labs_GetRecord | Lab Results |
astp_VETS_PatientHistory_Massage_GetRecord | Massage |
astp_VETS_PatientHistory_SurgicalProcedures_GetRecord | Surgery |
astp_VETS_PatientHistory_Transport_GetRecord | Transport |
astp_VETS_PatientHistory_Vaccinations_GetRecord | Vaccinations |
📱 Mobile Display Procedures (15 types)
| Procedure | Display Type |
astp_VETS_PatientHistory_A_GENERIC_Mobile | Generic fallback |
astp_VETS_PatientHistory_Accupuncture_Mobile | Acupuncture |
astp_VETS_PatientHistory_Anesthesia_Mobile | Anesthesia |
astp_VETS_PatientHistory_Certificates_Mobile | Certificates |
astp_VETS_PatientHistory_Chiropractic_Mobile | Chiropractic |
astp_VETS_PatientHistory_DentalProcedures_Mobile | Dental |
astp_VETS_PatientHistory_DiagnosticImaging_Mobile | Imaging |
astp_VETS_PatientHistory_Homeopathy_Mobile | Homeopathy |
astp_VETS_PatientHistory_Identification_Mobile | Identification |
astp_VETS_PatientHistory_Labs_Mobile | Lab Results |
astp_VETS_PatientHistory_Massage_Mobile | Massage |
astp_VETS_PatientHistory_SurgicalProcedures_Mobile | Surgery |
astp_VETS_PatientHistory_Transport_Mobile | Transport |
astp_VETS_PatientHistory_Vaccinations_Mobile | Vaccinations |
astp_VETS_PatientHistory_StartStopConsumables_Mobile | Consumables |
🔄 TempTable Aggregation Pipeline (13)
| Procedure | Stage |
astp_VETS_PatientHistory_TempTable_Step1TOP | Initial retrieval |
astp_VETS_PatientHistory_TempTable_Step3TOP | Secondary aggregation |
astp_VETS_PatientHistory_TempTable_ServiceChildren | Related services |
astp_VETS_PatientHistory_TempTable_KitRelationships | Kit/bundle links |
astp_VETS_PatientHistory_TempTable_Tasks | Associated tasks |
astp_VETS_PatientHistory_TempTable_FooterEdits | Footer controls |
astp_VETS_PatientHistory_TempTable_RightEdits | Right-panel edits |
astp_VETS_PatientHistory_TempTable_RightEditsRx | Rx edits |
astp_VETS_PatientHistory_TempTable_FileFilderFiles | Attachments |
astp_VETS_PatientHistory_TempTable_ServiceNoSQL | NoSQL data |
astp_VETS_PatientHistory_TempTable_OvarianScans | Reproduction |
astp_VETS_PatientHistory_TempTable_OpenList | Open items |
astp_VETS_PatientHistory_TempTable_RETURN | Final assembly |
📋 Update Procedures (10)
| Procedure | Purpose |
astp_VETS_PatientHistory_UpdatePatientHistoryByTypeandFieldName | Generic update |
astp_VETS_PatientHistory_UpdateRecord | Full record |
astp_VETS_PatientHistory_UpdateCreated | Created date |
astp_VETS_PatientHistory_QuantityUpdate | Quantity |
astp_VETS_PatientHistory_Certificates_UpdateRecord | Certificates |
astp_VETS_PatientHistory_Identification_UpdateRecord | Identification |
astp_VETS_PatientHistory_Vaccinations_UpdateRecord | Vaccinations |
astp_VETS_PatientHistory_UpdateServiceToChargeableConsumablesQTY | Consumables qty |
astp_VETS_PatientHistory_UpdateServiceToControlledSubstanceQTY | Controlled sub |
astp_VETS_PatientHistory_UpdateServiceToNoSQL | NoSQL data |
📋 Grid Views & Helpers (19)
| Procedure | Purpose |
astp_VETS_PatientHistory_ViewAsGrid | Main grid |
astp_VETS_PatientHistory_ViewAsGrid_GENERIC | Generic grid |
astp_VETS_PatientHistory_ViewAsGrid_Reproduction | Reproduction |
astp_VETS_PatientHistory_ViewAsGrid_Reprobreedingconnection | Breeding |
astp_VETS_PatientHistory_GetCategoryRef | Get category |
astp_VETS_PatientHistory_GetLockedCategoryRef | Locked category |
astp_VETS_PatientHistory_GetVariablesToEditPatientHistoryItemFromPrimKey | Edit variables |
astp_VETS_PatientHistory_SetPatientServiceTab | Set tab |
astp_VETS_PatientHistory_SetPatientSetStartStop | Start/stop |
astp_VETS_PatientHistory_ChangePatientHistoryCreatedDate | Change date |
astp_VETS_PatientHistory_NonChrgAnimalHistRecord | Non-charge |
astp_VETS_PatientHistory_SaveFilesFromServiceWizard | Save files |
astp_VETS_PatientHistory_StoredProcedure_VaccineRabies | Rabies logic |
astp_VETS_PatientHistory_TeamDocDetails | TeamDoc |
astp_VETS_PatientHistory_TeamDocDetails1 | TeamDoc v2 |
astp_VETS_PatientHistory_TeamDocEmbryo | Embryo |
astp_VETS_PatientHistory_DiagnosticImaging_TeamDoc | Imaging TD |
astp_VETS_PatientHistory_DiagnosticImagingOriginalFiles_FolderName_ListChanged | Files change |
afnc_VETS_PatientHistory_ExtendedUsePermissions | Permissions fn |
🤖 AI Integration Procedures
13 procedures powering AI-assisted content generation and suggestions
📊 Core AI Procedures (by execution)
astp_AI_GetTeamDocRef
Executions: 277
Purpose
Gets TeamDoc reference for AI context. Entry point for AI operations on documents.
astp_AI_CreateTeamDocSection
Executions: 240
Purpose
Creates AI-generated content sections within TeamDocs. Integrates with the AI assistant to produce structured documentation.
astp_AI_GetCredentials
Executions: 131
Purpose
Retrieves API credentials for AI service calls. Manages secure credential storage and retrieval.
astp_AI_CheckItemPermission
Executions: 117
Purpose
Verifies user has permission for AI operations on specific items. Security checkpoint before AI processing.
astp_AI_LogUsage
Executions: 109
Purpose
Logs AI usage for tracking, billing, and auditing. Records API calls, tokens used, and user attribution.
📋 All AI Procedures (13 total)
| Procedure | Executions | Purpose |
astp_AI_GetTeamDocRef | 277 | Get TeamDoc for AI context |
astp_AI_CreateTeamDocSection | 240 | Create AI-generated section |
astp_AI_GetCredentials | 131 | Get API credentials |
astp_AI_CheckItemPermission | 117 | Check AI permissions |
astp_AI_LogUsage | 109 | Log AI usage |
astp_AI_SuggestConsumableLinks | 46 | AI-suggest consumable links |
astp_AI_SuggestPHDetailsStructure | 45 | Suggest PH structure |
astp_AI_SuggestTaskedProcedures | 45 | Suggest tasks |
astp_AI_GetItemContext | 24 | Get item context for AI |
astp_AI_GetApplicableSections | 18 | Get applicable sections |
astp_AI_ApproveConsumableLink | - | Approve AI suggestion |
astp_AI_ApproveTaskedProcedure | - | Approve tasked procedure |
astp_AI_CreatePHDetailsField | - | Create PH field via AI |
📋 PHDetails (Patient History Details) System
28 procedures for managing customizable evaluation fields and structure
📋 All PHDetails Procedures
The PHDetails system manages the customizable evaluation fields (dropdowns, checkboxes, text fields) that appear on professional service records.
Mobile View/Edit Procedures
| Procedure | Purpose |
astp_PHDetails_Mobile_ViewcTABResources | View resources tab |
astp_PHDetails_Mobile_ViewcTABImages | View images tab |
astp_PHDetails_Mobile_ViewcTABFiles | View files tab |
astp_PHDetails_Mobile_ViewcTABVideo | View video tab |
astp_PHDetails_Mobile_EditStructure | Edit field structure |
astp_PHDetails_Mobile_EditEval | Edit evaluation |
astp_PHDetails_Mobile_GetEvalValue | Get eval value |
astp_PHDetails_Mobile_ReadEval | Read evaluation |
astp_PHDetails_Mobile_ReadEvalValue | Read eval value |
Structure Management
| Procedure | Purpose |
astp_PHDetails_Mobile_AddStructure | Add new structure field |
astp_PHDetails_Mobile_UpdateStructure | Update structure |
astp_PHDetails_Mobile_DeleteStructure | Delete structure |
astp_PHDetails_Mobile_EditStructureOptions | Edit dropdown options |
astp_PHDetails_O_CreateDefaultList | Create default field list |
Evaluation Value Management
| Procedure | Purpose |
astp_PHDetails_EvalValues | Get all eval values |
astp_PHDetails_Mobile_EvalValueCreate | Create eval value |
astp_PHDetails_Mobile_EvalValueUpdate | Update eval value |
astp_PHDetails_Mobile_EvalValueDelete | Delete eval value |
astp_PHDetails_Mobile_EvalValueOptionUpdate | Update dropdown option |
astp_PHDetails_Mobile_EvalCheckBoxUpdate | Update checkbox |
astp_PHDetails_Mobile_EvalNotesUpdate | Update notes |
astp_PHDetails_Mobile_EvalOptionValueADD | Add option value |
astp_PHDetails_Mobile_EvalOptionValueDELETE | Delete option value |
File Management
| Procedure | Purpose |
astp_PHDetails_FileBeforeUpload | Pre-upload validation |
astp_PHDetails_FileDelete | Delete file |
astp_PHDetails_FileNotesUpdate | Update file notes |
🔧 Database Maintenance Procedures
System procedures for database health and maintenance
📋 Maintenance Procedures
| Procedure | Executions | Purpose |
sstp_Database_Maintenance_ApplyPermissions | 410 | Apply table permissions |
sstp_Database_Maintenance_DBObjectsCleanup | 409 | Cleanup orphaned objects |
sstp_Database_Maintenance_CleanUp | 409 | General cleanup |
sstp_Database_Maintenance_RebuildMissingReplicationTriggers | 405 | Rebuild triggers |
sstp_Database_Maintenance_RebuildIndexes | 24 | Rebuild indexes |
sstp_Database_Maintenance_UpdateStatistics | 24 | Update statistics |
sstp_Security_Maintenance_CleanUp | 936 | Security cleanup |
sstp_Security_Maintenance_RevokeExpiredUsers | 465 | Expire inactive users |
🔌 Automation & Integration Procedures
External system integrations and automated workflows
📋 Automation Procedures
| Procedure | Executions | Purpose |
astp_Automate_spHTTPRequest | 46,804 | HTTP request handler (external APIs) |
astp_Automate_GetGoogleGeoLocation | 34,655 | Google geolocation lookup |
astp_API_JSON_GetJSONFROMSQL | 566 | Generate JSON from SQL |
astp_QuickBooks_GetOutstanding | 5 | QuickBooks integration |
📊 HTML Generation Functions (afnc_)
24+ functions for generating HTML from SQL
📋 All HTML Functions
| Function | Purpose |
afnc_HTML_AuthenticatedNow1Animal0 | Animal card outer container |
afnc_HTML_AuthenticatedNow1Animal1 | Animal card inner content |
afnc_HTML_AuthenticatedNow1Item0 | Item card container |
afnc_HTML_CloseMobileMenu | Close mobile menu HTML |
afnc_HTML_CloseMobileTaskMenu | Close task menu HTML |
afnc_HTML_Contacts_FullName | Format contact name |
afnc_HTML_QuickButtonisretaskable | Quick retask button |
afnc_HTML_QuickNumberInputisretaskable | Quick number input |
afnc_HTML_QuickSelectDueDate | Due date picker |
afnc_HTML_QuickSelectisretaskable | Quick select dropdown |
afnc_HTML_SimpleDivide | Simple divider |
afnc_HTML_StripHTML | Strip HTML tags |
afnc_HTML_TreeViewInputSPAN | Tree input span |
afnc_HTML_TreeViewSPAN | Tree view span |
afnc_HTML_TreeViewSPAN2 | Tree view span v2 |
afnc_HTML_TreeViewTaskQuickNote | Quick note in tree |
afnc_HTML_TreeViewTaskTable | Task table in tree |
afnc_HTML_TreeViewTaskTableBOTTOM | Task table footer |
afnc_HTML_TreeViewTaskTableTOP | Task table header |
afnc_HTML_VeterinaryTaskList | Vet task list |
afnc_HTML_VeterinaryTree | Veterinary tree |
afnc_HTML_VETS_Embryo_MgrList | Embryo manager list |
[PATTERN] Common Integration Patterns
Standard AJAX Call Pattern
All V.E.T.S. procedures follow this consistent pattern:
- JavaScript Function: Client-side function initiates action
- AjaxHelper Class: Handles AJAX request preparation
- VB.NET Handler: Routes to specific stored procedure
- SQL Execution: Procedure generates HTML response
- DOM Injection: HTML injected into page without refresh
Key Integration Points
- Mobile Detection: Automatic device-specific HTML generation
- Permission Checks: Security enforced at HTML generation level
- Error Handling: Graceful failure with user feedback
- State Management: Session storage for complex workflows
[INSIGHT] Key Insights & Best Practices
Architecture Understanding
- Stored Procedure-Driven UI: HTML generated server-side in SQL
- View-Based Security: Never query tables directly
- AJAX-First Design: No page refreshes in modern interface
- Mobile-Responsive: Device-aware HTML generation
- Multi-Tenant: Isolated data with shared infrastructure
Development Guidelines
- Follow Patterns: Use established AJAX call structures
- Test Comprehensively: Mobile, desktop, and permission scenarios
- Document Dependencies: Track procedure relationships
- Security First: Permissions checked at HTML generation
- Plan for APIs: Procedure names will become API endpoints