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

CategoryCountPrefix
Application Stored Procedures1,478astp_
System Stored Procedures1,098sstp_
HTML Generation Functions24+afnc_HTML_
Mobile UI Procedures229+*Mobile*
Total Documented Here150+ 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:

ProcedureFuture 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
ProcedurePurpose
astp_SocialMedia_Admin_AuthenticatedNowNon-mobile dashboard generation
astp_SocialMedia_Admin_AuthenticateActivateAccount activation flow
astp_Security_AutoLoginGUIDPassDELETEClean up auto-login tokens
sstp_Security_Maintenance_CleanUpSecurity maintenance tasks
sstp_Security_Maintenance_RevokeExpiredUsersExpire inactive accounts
sstp_TeamDoc_TeamDocPermissions_GetPermissionsRetrieve 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)

ValueDevice TypeSizing
0Desktop (full size)100% width, large fonts
1Large tablet730px width
2Small tablet500px width, 20px fonts
3Large phoneCompact layout
4Medium phoneFurther reduced
5Small phoneMinimal layout
11Very small/compactUltra-compact
15Wide tabletSpecial wide format
>50Scaled/thumbnailThumbnail view

Color Coding System (@ColorCode)

CodeLogicColors
0Location StatusCyan=Home, Pink=Hospital, Gray=Away
1Herd-BasedGradient from HerdRef GUID
2Species-BasedColors per species
3Sex-BasedColors per sex
4CustomApplication-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

TransactionTypeBackground
ClientAppointmentServicesLight Green
RXTan
VAPink
DEAYellow

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
ProcedurePurpose
astp_Items_TreeList_AddTreeOrItemTeamDocAdd new TeamDoc for item/tree
astp_Items_TreeList_EditTreeOrItemTeamDocEdit TeamDoc (legacy)
astp_Items_TreeList_GetRelatedNodesGet related tree nodes
astp_Items_TreeList_GetServiceItemsBySpeciesandFilterSpecies-filtered services
astp_Items_TreeList_GetByTreeListTypeandClientRefClient-filtered tree items
astp_Items_TreeList_GetByTreeListTypeandHerdRefHerd-filtered tree items
astp_Items_TreeList_GetClientAppointmentServicesMobileClient appointment services
astp_Items_TreeList_INSERTInsert new tree list item
astp_Items_TreeListItems_INSERTInsert item into tree
astp_Items_TreeListItems_DELETERemove item from tree
astp_Items_Items_isretaskableCheck if item can be retasked
astp_Items_Tree_GetDefaultViewByHostDefault tree view by host
astp_Items_TeamDocWebsite_Store_GetKitChildrenGet 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
ProcedureExecutionsPurpose
sstp_TeamDoc_WebsiteGetStoreFrontWebPage814Store front page
sstp_TeamDoc_WebsiteGetFooterNav717Footer navigation
sstp_TeamDoc_Inputs_GetWebPage418Get webpage input
sstp_TeamDoc_WebsiteGetSubMenus-Submenu generation
sstp_Teamdoc_WebsiteGetLeftMenuLinksMobile166Mobile left menu
sstp_Teamdoc_WebsiteGetLeftMenuLinksMobile2319Mobile left menu v2
sstp_Teamdoc_WebsiteOpenWebPageMobile273Open page on mobile
sstp_Teamdoc_WebsiteOpenStoreMobile-Open store on mobile
sstp_Teamdoc_WebsiteOpenRoughstockBrokerMobile108Roughstock broker mobile
sstp_Teamdoc_WebsiteViewItemMobile-View item on mobile
sstp_TeamDoc_WebsiteInsertActivityLog286Log website activity
sstp_TeamDocRef_WebsiteGetLogo3,632Get website logo
astp_TeamDoc_Website_GetSettings405Get 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

  1. Create task record in database
  2. Associate with animal via AnimalRef
  3. Create associated TeamDoc document
  4. Assign default access permissions
  5. 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
ProcedurePurpose
astp_VETS_TeamDoc_Tasks_StartTaskStart task timer/workflow
astp_VETS_TeamDoc_Tasks_StopTaskStop task timer
astp_VETS_TeamDoc_Tasks_StartStopToggle start/stop state
astp_VETS_TeamDoc_Tasks_CompleteTaskMark task complete
astp_VETS_TeamDoc_Tasks_UpdateProgressUpdate completion percentage
astp_VETS_TeamDoc_Tasks_UpdateTaskDueDateChange due date
astp_VETS_TeamDoc_Tasks_TaskListDisplay task list
astp_VETS_TeamDoc_Tasks_DeleteThreadDelete task thread
astp_VETS_TeamDoc_Tasks_isretaskableCheck if task can be reassigned
📋 Task Assignment Procedures
ProcedurePurpose
astp_VETS_TeamDoc_Tasks_ResponsibleEditEdit responsible party
astp_VETS_TeamDoc_Tasks_UpdateResponsibleUpdate responsible party
astp_VETS_TeamDoc_Tasks_ViewResponsibleDropdownResponsible selection dropdown
astp_VETS_TeamDoc_Tasks_UpdateAssignedToByGroupAssign to group
astp_VETS_TeamDoc_Tasks_UpdateAssignedToByIndividualAssign to individual
astp_VETS_TeamDoc_Tasks_ViewAssignedToDropdownByGroupGroup assignment dropdown
astp_VETS_TeamDoc_Tasks_ViewAssignedToDropdownByIndividualIndividual assignment dropdown
astp_VETS_TeamDoc_Tasks_AuthorizedByEditEdit authorization
astp_VETS_TeamDoc_Tasks_UpdateAuthorizedByUpdate authorization
astp_VETS_TeamDoc_Tasks_ViewAuthorizedByDropdownAuthorization dropdown
📋 Task Helper Procedures
ProcedurePurpose
astp_VETS_TeamDoc_Tasks_AnimalSelectAnimal selection for task
astp_VETS_TeamDoc_Tasks_ClientSelectClient selection for task
astp_VETS_TeamDoc_Tasks_ClassifySelectTask classification selection
astp_VETS_TeamDoc_Tasks_LocationSelectLocation selection
astp_VETS_TeamDoc_Tasks_GetImagesGet task images
astp_VETS_TeamDoc_Tasks_ImagesTask image management
astp_VETS_TeamDoc_Tasks_GetLinkDataGet linked data
astp_VETS_TeamDoc_Tasks_UpdateItemRefinTaskUpdate item reference
astp_VETS_TeamDoc_Tasks_SearchBillTreeItemSearch billable items
astp_VETS_TeamDoc_Tasks_TreeViewTaskTableTree view of tasks
astp_VETS_TeamDoc_Tasks_CreateQuickNoteQuick note creation
astp_VETS_TeamDoc_Tasks_QuickNoteAddAdd quick note
astp_VETS_TeamDoc_Tasks_CreateTaskAssociatedReminderMessageCreate reminder
astp_VETS_TeamDoc_Tasks_CreatePatientHistoryAssociatedReminderMessagePatient 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

TabPurposeKey Fields
NameBasic identificationName, Registration, Alias
ClassificationSpecies, breed, categorySpecies, Breed, Color, Sex
Age/WeightPhysical characteristicsBirth date, Weight, Height
CommentsAdditional notesGeneral comments, Notes
Sales/OwnershipCommercial informationPrice, 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
ProcedurePurpose
sstp_Teamdoc_WebsiteAddEditHerdHerd add/edit form
sstp_Teamdoc_WebsiteAddEditContactContact add/edit form
sstp_Teamdoc_WebsiteAddNewContactNew contact form
sstp_Teamdoc_WebsiteAddNewClientMobileNew client mobile form
sstp_Teamdoc_WebsiteAddEditOwnerMobileOwner edit mobile form
astp_SocialMedia_Admin_editHerdsinframeHerd editing in iframe
astp_SocialMedia_Admin_EditClientPermissionsClient permission editing
astp_AnimalSales_GetPhotoAlbumContentAnimal photo album
astp_AnimalSales_Tree_GetDefaultViewByHostAnimal sales tree view
astp_VETS_Animals_PedigreeTreeMobilePedigree tree display
📋 Animal TeamDoc Procedures
ProcedureExecutionsPurpose
astp_VETS_TeamDoc_CreateDoc1,362Create animal TeamDoc
astp_VETS_TeamDoc_CreateDocPermissions1,352Set animal TeamDoc permissions
astp_VETS_TeamDoc_CreateDoc_Permissions1,352Permissions sub-procedure
astp_VETS_TeamDoc_CreateDoc_Permissions_Herds1,270Herd-based permissions
astp_VETS_TeamDoc_CreateDoc_Herd98Create herd TeamDoc
astp_VETS_TeamDoc_CreateDoc_BackgroundSilentByPIMSLogin1,329Background 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)
ProcedureInput Type
sstp_TeamDoc_Inputs_SaveInputBase (all types)
sstp_TeamDoc_Inputs_SaveInputSubjectSubject (folder)
sstp_TeamDoc_Inputs_SaveInputTaskTask
sstp_TeamDoc_Inputs_SaveInputWebPageWebPage
sstp_TeamDoc_Inputs_SaveInputChartChart
sstp_TeamDoc_Inputs_SaveInputCommentComment
sstp_TeamDoc_Inputs_SaveInputFileFile
sstp_TeamDoc_Inputs_SaveInputImageImage
sstp_TeamDoc_Inputs_SaveInputFileFolderFileFolder
sstp_TeamDoc_Inputs_SaveInputPhotoAlbumPhotoAlbum
sstp_TeamDoc_Inputs_SaveInputPollPoll
sstp_TeamDoc_Inputs_SaveInputContactListContactList
📋 Input Retrieval Procedures
ProcedureExecutionsPurpose
sstp_TeamDoc_Inputs_GetInput122Get single input
sstp_TeamDoc_Inputs_GetSubjects338Get subject folders
sstp_TeamDoc_Inputs_GetComments337Get threaded comments
sstp_TeamDoc_Inputs_GetTasks328Get tasks
sstp_TeamDoc_Inputs_GetCharts329Get charts
sstp_TeamDoc_Inputs_GetFiles328Get files
sstp_TeamDoc_Inputs_GetImages328Get images
sstp_TeamDoc_Inputs_GetFileFolder329Get file folders
sstp_TeamDoc_Inputs_GetPhotoAlbum328Get photo albums
sstp_TeamDoc_Inputs_GetPolls328Get polls
sstp_TeamDoc_Inputs_GetContactLists328Get contact lists
sstp_TeamDoc_Inputs_GetWebPage418Get webpage
sstp_TeamDoc_Inputs_GetDBReports390Get DB reports
sstp_TeamDoc_Inputs_GetTaskSummary328Task summary
sstp_TeamDoc_Inputs_GetFilesPanel207Files panel
sstp_TeamDoc_Inputs_GetRecentUpdates206Recent updates
sstp_TeamDoc_Inputs_GetOutlineSubjects2206Subject outline
sstp_TeamDoc_Inputs_GetOutlineSections206Section outline
📋 Input Modification Procedures
ProcedurePurpose
sstp_TeamDoc_Inputs_MoveInputMove between parents
sstp_TeamDoc_Inputs_CopyInputDuplicate with sub-tables
sstp_TeamDoc_Inputs_DeleteInputSoft delete (sets Deleted)
sstp_TeamDoc_Inputs_SetTaskStatusChange task status
sstp_TeamDoc_Inputs_SetTaskPriorityChange task priority
sstp_TeamDoc_Inputs_SetTaskProgressUpdate task progress
sstp_TeamDoc_Inputs_TaskSearchSearch tasks
📋 Document Management Procedures
ProcedureExecutionsPurpose
sstp_TeamDoc_Documents_SaveDocument2,348Create/update document
sstp_TeamDoc_Documents_GetUpdatedDocuments1,375Recently updated docs
sstp_TeamDoc_Documents_UpdateLastRead339Update last read timestamp
sstp_TeamDoc_RelatedDocuments_GetRelatedDocuments207Get related documents
sstp_TeamDoc_UserAdmin_GetUser175Get 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

  1. Step 1: Initial service selection and parent record creation
  2. Step 2: Child service addition and relationship management
  3. Step 3: Shopping cart integration and pricing
  4. Step 4: Patient history record completion
📊 GetRecord Procedures (14 types)
ProcedureRecord Type
astp_VETS_PatientHistory_Accupuncture_GetRecordAcupuncture
astp_VETS_PatientHistory_Anesthesia_GetRecordAnesthesia
astp_VETS_PatientHistory_Certificates_GetRecordCertificates
astp_VETS_PatientHistory_Chiropractic_GetRecordChiropractic
astp_VETS_PatientHistory_DentalProcedures_GetRecordDental
astp_VETS_PatientHistory_DiagnosticImaging_GetRecordX-ray/Ultrasound
astp_VETS_PatientHistory_DiagnosticProcedures_GetRecordDiagnostics
astp_VETS_PatientHistory_Homeopathy_GetRecordHomeopathy
astp_VETS_PatientHistory_Identification_GetRecordMicrochip/Brand
astp_VETS_PatientHistory_Labs_GetRecordLab Results
astp_VETS_PatientHistory_Massage_GetRecordMassage
astp_VETS_PatientHistory_SurgicalProcedures_GetRecordSurgery
astp_VETS_PatientHistory_Transport_GetRecordTransport
astp_VETS_PatientHistory_Vaccinations_GetRecordVaccinations
📱 Mobile Display Procedures (15 types)
ProcedureDisplay Type
astp_VETS_PatientHistory_A_GENERIC_MobileGeneric fallback
astp_VETS_PatientHistory_Accupuncture_MobileAcupuncture
astp_VETS_PatientHistory_Anesthesia_MobileAnesthesia
astp_VETS_PatientHistory_Certificates_MobileCertificates
astp_VETS_PatientHistory_Chiropractic_MobileChiropractic
astp_VETS_PatientHistory_DentalProcedures_MobileDental
astp_VETS_PatientHistory_DiagnosticImaging_MobileImaging
astp_VETS_PatientHistory_Homeopathy_MobileHomeopathy
astp_VETS_PatientHistory_Identification_MobileIdentification
astp_VETS_PatientHistory_Labs_MobileLab Results
astp_VETS_PatientHistory_Massage_MobileMassage
astp_VETS_PatientHistory_SurgicalProcedures_MobileSurgery
astp_VETS_PatientHistory_Transport_MobileTransport
astp_VETS_PatientHistory_Vaccinations_MobileVaccinations
astp_VETS_PatientHistory_StartStopConsumables_MobileConsumables
🔄 TempTable Aggregation Pipeline (13)
ProcedureStage
astp_VETS_PatientHistory_TempTable_Step1TOPInitial retrieval
astp_VETS_PatientHistory_TempTable_Step3TOPSecondary aggregation
astp_VETS_PatientHistory_TempTable_ServiceChildrenRelated services
astp_VETS_PatientHistory_TempTable_KitRelationshipsKit/bundle links
astp_VETS_PatientHistory_TempTable_TasksAssociated tasks
astp_VETS_PatientHistory_TempTable_FooterEditsFooter controls
astp_VETS_PatientHistory_TempTable_RightEditsRight-panel edits
astp_VETS_PatientHistory_TempTable_RightEditsRxRx edits
astp_VETS_PatientHistory_TempTable_FileFilderFilesAttachments
astp_VETS_PatientHistory_TempTable_ServiceNoSQLNoSQL data
astp_VETS_PatientHistory_TempTable_OvarianScansReproduction
astp_VETS_PatientHistory_TempTable_OpenListOpen items
astp_VETS_PatientHistory_TempTable_RETURNFinal assembly
📋 Update Procedures (10)
ProcedurePurpose
astp_VETS_PatientHistory_UpdatePatientHistoryByTypeandFieldNameGeneric update
astp_VETS_PatientHistory_UpdateRecordFull record
astp_VETS_PatientHistory_UpdateCreatedCreated date
astp_VETS_PatientHistory_QuantityUpdateQuantity
astp_VETS_PatientHistory_Certificates_UpdateRecordCertificates
astp_VETS_PatientHistory_Identification_UpdateRecordIdentification
astp_VETS_PatientHistory_Vaccinations_UpdateRecordVaccinations
astp_VETS_PatientHistory_UpdateServiceToChargeableConsumablesQTYConsumables qty
astp_VETS_PatientHistory_UpdateServiceToControlledSubstanceQTYControlled sub
astp_VETS_PatientHistory_UpdateServiceToNoSQLNoSQL data
📋 Grid Views & Helpers (19)
ProcedurePurpose
astp_VETS_PatientHistory_ViewAsGridMain grid
astp_VETS_PatientHistory_ViewAsGrid_GENERICGeneric grid
astp_VETS_PatientHistory_ViewAsGrid_ReproductionReproduction
astp_VETS_PatientHistory_ViewAsGrid_ReprobreedingconnectionBreeding
astp_VETS_PatientHistory_GetCategoryRefGet category
astp_VETS_PatientHistory_GetLockedCategoryRefLocked category
astp_VETS_PatientHistory_GetVariablesToEditPatientHistoryItemFromPrimKeyEdit variables
astp_VETS_PatientHistory_SetPatientServiceTabSet tab
astp_VETS_PatientHistory_SetPatientSetStartStopStart/stop
astp_VETS_PatientHistory_ChangePatientHistoryCreatedDateChange date
astp_VETS_PatientHistory_NonChrgAnimalHistRecordNon-charge
astp_VETS_PatientHistory_SaveFilesFromServiceWizardSave files
astp_VETS_PatientHistory_StoredProcedure_VaccineRabiesRabies logic
astp_VETS_PatientHistory_TeamDocDetailsTeamDoc
astp_VETS_PatientHistory_TeamDocDetails1TeamDoc v2
astp_VETS_PatientHistory_TeamDocEmbryoEmbryo
astp_VETS_PatientHistory_DiagnosticImaging_TeamDocImaging TD
astp_VETS_PatientHistory_DiagnosticImagingOriginalFiles_FolderName_ListChangedFiles change
afnc_VETS_PatientHistory_ExtendedUsePermissionsPermissions 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)
ProcedureExecutionsPurpose
astp_AI_GetTeamDocRef277Get TeamDoc for AI context
astp_AI_CreateTeamDocSection240Create AI-generated section
astp_AI_GetCredentials131Get API credentials
astp_AI_CheckItemPermission117Check AI permissions
astp_AI_LogUsage109Log AI usage
astp_AI_SuggestConsumableLinks46AI-suggest consumable links
astp_AI_SuggestPHDetailsStructure45Suggest PH structure
astp_AI_SuggestTaskedProcedures45Suggest tasks
astp_AI_GetItemContext24Get item context for AI
astp_AI_GetApplicableSections18Get 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

ProcedurePurpose
astp_PHDetails_Mobile_ViewcTABResourcesView resources tab
astp_PHDetails_Mobile_ViewcTABImagesView images tab
astp_PHDetails_Mobile_ViewcTABFilesView files tab
astp_PHDetails_Mobile_ViewcTABVideoView video tab
astp_PHDetails_Mobile_EditStructureEdit field structure
astp_PHDetails_Mobile_EditEvalEdit evaluation
astp_PHDetails_Mobile_GetEvalValueGet eval value
astp_PHDetails_Mobile_ReadEvalRead evaluation
astp_PHDetails_Mobile_ReadEvalValueRead eval value

Structure Management

ProcedurePurpose
astp_PHDetails_Mobile_AddStructureAdd new structure field
astp_PHDetails_Mobile_UpdateStructureUpdate structure
astp_PHDetails_Mobile_DeleteStructureDelete structure
astp_PHDetails_Mobile_EditStructureOptionsEdit dropdown options
astp_PHDetails_O_CreateDefaultListCreate default field list

Evaluation Value Management

ProcedurePurpose
astp_PHDetails_EvalValuesGet all eval values
astp_PHDetails_Mobile_EvalValueCreateCreate eval value
astp_PHDetails_Mobile_EvalValueUpdateUpdate eval value
astp_PHDetails_Mobile_EvalValueDeleteDelete eval value
astp_PHDetails_Mobile_EvalValueOptionUpdateUpdate dropdown option
astp_PHDetails_Mobile_EvalCheckBoxUpdateUpdate checkbox
astp_PHDetails_Mobile_EvalNotesUpdateUpdate notes
astp_PHDetails_Mobile_EvalOptionValueADDAdd option value
astp_PHDetails_Mobile_EvalOptionValueDELETEDelete option value

File Management

ProcedurePurpose
astp_PHDetails_FileBeforeUploadPre-upload validation
astp_PHDetails_FileDeleteDelete file
astp_PHDetails_FileNotesUpdateUpdate file notes

🔧 Database Maintenance Procedures

System procedures for database health and maintenance

📋 Maintenance Procedures
ProcedureExecutionsPurpose
sstp_Database_Maintenance_ApplyPermissions410Apply table permissions
sstp_Database_Maintenance_DBObjectsCleanup409Cleanup orphaned objects
sstp_Database_Maintenance_CleanUp409General cleanup
sstp_Database_Maintenance_RebuildMissingReplicationTriggers405Rebuild triggers
sstp_Database_Maintenance_RebuildIndexes24Rebuild indexes
sstp_Database_Maintenance_UpdateStatistics24Update statistics
sstp_Security_Maintenance_CleanUp936Security cleanup
sstp_Security_Maintenance_RevokeExpiredUsers465Expire inactive users

🔌 Automation & Integration Procedures

External system integrations and automated workflows

📋 Automation Procedures
ProcedureExecutionsPurpose
astp_Automate_spHTTPRequest46,804HTTP request handler (external APIs)
astp_Automate_GetGoogleGeoLocation34,655Google geolocation lookup
astp_API_JSON_GetJSONFROMSQL566Generate JSON from SQL
astp_QuickBooks_GetOutstanding5QuickBooks integration

📊 HTML Generation Functions (afnc_)

24+ functions for generating HTML from SQL

📋 All HTML Functions
FunctionPurpose
afnc_HTML_AuthenticatedNow1Animal0Animal card outer container
afnc_HTML_AuthenticatedNow1Animal1Animal card inner content
afnc_HTML_AuthenticatedNow1Item0Item card container
afnc_HTML_CloseMobileMenuClose mobile menu HTML
afnc_HTML_CloseMobileTaskMenuClose task menu HTML
afnc_HTML_Contacts_FullNameFormat contact name
afnc_HTML_QuickButtonisretaskableQuick retask button
afnc_HTML_QuickNumberInputisretaskableQuick number input
afnc_HTML_QuickSelectDueDateDue date picker
afnc_HTML_QuickSelectisretaskableQuick select dropdown
afnc_HTML_SimpleDivideSimple divider
afnc_HTML_StripHTMLStrip HTML tags
afnc_HTML_TreeViewInputSPANTree input span
afnc_HTML_TreeViewSPANTree view span
afnc_HTML_TreeViewSPAN2Tree view span v2
afnc_HTML_TreeViewTaskQuickNoteQuick note in tree
afnc_HTML_TreeViewTaskTableTask table in tree
afnc_HTML_TreeViewTaskTableBOTTOMTask table footer
afnc_HTML_TreeViewTaskTableTOPTask table header
afnc_HTML_VeterinaryTaskListVet task list
afnc_HTML_VeterinaryTreeVeterinary tree
afnc_HTML_VETS_Embryo_MgrListEmbryo manager list

[PATTERN] Common Integration Patterns

Standard AJAX Call Pattern

All V.E.T.S. procedures follow this consistent pattern:

  1. JavaScript Function: Client-side function initiates action
  2. AjaxHelper Class: Handles AJAX request preparation
  3. VB.NET Handler: Routes to specific stored procedure
  4. SQL Execution: Procedure generates HTML response
  5. 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
Standard UserName/Password Login:
 
Username:  
Password: