How pmcrawler/anvil works
1. This is an Anvil full-stack Python app, so the architecture splits cleanly into browser-side UI in client_code/ and backend business logic in server_code/. Anvil handles the client/server bridge, so client forms can call server modules directly without a separate API layer.
2. The app shell is centered around Frame and StartupModule.py. Frame is likely the shared layout/navigation container, while StartupModule.py is the app entry/bootstrap point that decides which top-level form to show on launch.
3. The main product surface is an event-management subsystem under client_code/Events/. It includes:
- EventList for browsing collections
- EventView and EventDetails/EventDetails2 for detailed inspection
- EventForm for creating/editing events
- AIResponse for showing AI-generated output tied to an event workflow
- card/item templates used by repeated-list UI components
4. The task subsystem under client_code/Tasks/ mirrors the event side with TaskList and TaskForm. This suggests the app supports at least two domain objects with similar CRUD-style interactions, but they are kept in separate UI modules rather than one shared generic screen.
5. On the backend, EventsModule.py and TasksModule.py are the main service boundaries. These modules likely own domain operations such as loading, saving, updating, and validating event/task records, and they are the canonical place where client forms fetch or persist data.
6. models.py is the shared domain layer for server-side data structures, while sample_events.py appears to provide fixture/demo content for local development or seeded examples. This indicates the server has an explicit data model instead of embedding record shapes in the UI.
7. The event workflow has an AI augmentation path. event_ai.py and prompts.py indicate backend prompt construction and model interaction, and the AIResponse client form is the presentation point for that generated text. So the AI feature sits behind the server boundary, not in the browser.
8. ui_builder.py and ui_config.py inside client_code/Events/ suggest the event UI is at least partly assembled/configured dynamically rather than being purely static forms. That points to a reusable UI-generation layer for event screens, cards, or form variants.
9. The UI is componentized using Anvil form templates: nearly every screen has a form_template.yaml, and some list views have nested item/card templates. That means repeated rendering is handled by template components, especially for list views and cards, rather than hand-built DOM logic.
10. The theme layer is separated from app logic in theme/. theme.css, theme2.css, card_sample.css, and the theme parameter/template files provide shared styling and visual system configuration across the forms. This is the repo’s main presentation boundary.
11. The overall data flow is: user action in a client form → client-side form logic and templates → server module call for domain work → optional AI processing for events → returned data rendered back into list/detail/forms. The two main business domains, Events and Tasks, are isolated but share the same app shell and theme system.
12. For an architecture diagram, the key boxes are: Anvil client UI shell, Events UI subsystem, Tasks UI subsystem, server domain modules, AI integration, and shared theme/assets. The important arrows are client-to-server calls for CRUD and AI responses, with the server layer owning authoritative business logic and data shaping.
Main entry points: Events Events UI · EventsModule.py EventsModule · Frame Frame · Tasks Tasks UI
Components 17
Client UI
Browser-side forms, shells, and reusable templates.
- Startup · App entry point that selects the initial form.
client_code/StartupModule.py - Frame · Shared layout and navigation container used by forms.
client_code/Frame - Form1 · Top-level form present in the client tree.
client_code/Form1 - Events UI · Client-side event management surface and reusable event templates.
client_code/Events - EventList · List view for browsing events and opening records.
client_code/Events/EventList - EventView · Event inspection view with nested item templates.
client_code/Events/EventView - EventForm · Create and edit event records.
client_code/Events/EventForm - EventDetails · Detailed event presentation screen.
client_code/Events/EventDetails - AIResponse · Client view for displaying AI-generated event text.
client_code/Events/AIResponse - Tasks UI · Client-side task management surface.
client_code/Tasks - TaskList · Task list view with repeated item template rendering.
client_code/Tasks/TaskList - TaskForm · Create and edit task records.
client_code/Tasks/TaskForm
Server Logic
Backend domain modules, models, and AI prompt flow.
- EventsModule · Backend boundary for event load/save/update operations.
server_code/EventsModule.py - TasksModule · Backend boundary for task load/save/update operations.
server_code/TasksModule.py - AI Engine · Server-side event AI flow combining prompt construction and model calls.
server_code/event_ai.py - Models · Server-side shared data structures for the application.
server_code/models.py
Theme
Shared visual styling and theme configuration.
- Theme Assets · Shared CSS and theme parameters/templates used across forms.
theme
Connections 23
- Startup → Frame: launches · Startup chooses the shell or first visible form.
- Startup → Form1: opens · Initial app flow may route to the default form.
- Frame → Events UI: hosts · Shared shell contains the main events experience.
- Frame → Tasks UI: hosts · Shared shell contains the main tasks experience.
- Events UI → EventList: navigates · Event area centers on browsing collections.
- Events UI → EventView: navigates · Event area opens detailed inspection views.
- Events UI → EventForm: navigates · Event area provides create/edit flows.
- Events UI → EventDetails: navigates · Event area includes detailed record display.
- Events UI → AIResponse: renders · AI-generated output is shown in the event workflow.
- EventList → EventsModule: calls · List views fetch event collections from the backend.
- EventView → EventsModule: calls · Detail views request event data and actions.
- EventForm → EventsModule: calls · Editor persists and validates event changes.
- EventDetails → EventsModule: calls · Details screens retrieve authoritative event records.
- AIResponse → AI Engine: shows output · AI view displays server-generated event text.
- EventsModule → Models: uses · Event service works through shared domain models.
- Tasks UI → TaskList: navigates · Task area centers on browsing task collections.
- Tasks UI → TaskForm: navigates · Task area provides task create/edit flow.
- TaskList → TasksModule: calls · Task list fetches task collections from backend services.
- TaskForm → TasksModule: calls · Task editor persists task changes through backend service.
- TasksModule → Models: uses · Task service works through shared domain models.
- Events UI → Theme Assets: styles · Event screens inherit shared presentation rules.
- Tasks UI → Theme Assets: styles · Task screens inherit shared presentation rules.
- Frame → Theme Assets: styles · Shell layout is themed with shared assets.