← Back to Technical Documentation | ← Back to Project
| Need to... | Look in... |
|---|---|
| Load/save application state | state.js |
| Handle workflow navigation | navigation.js |
| Import Omeka S data | steps/input.js |
| Map fields to Wikidata properties | steps/mapping.js, mapping/ |
| Search Wikidata properties | mapping/core/property-searcher.js |
| Transform field values | transformations.js |
| Reconcile entities with Wikidata | steps/reconciliation.js, reconciliation/ |
| Detect and display reference links | steps/step4.js, references/ |
| Call Wikidata API | api/wikidata.js |
| Create UI elements | ui/components.js |
| Handle modals | modals.js |
| Manage events between modules | events.js |
| Export to QuickStatements | steps/export.js |
| Handle CORS issues | utils/cors-proxy.js |
| Validate property constraints | mapping/core/constraint-validator.js |
The application follows a modular, event-driven architecture:
- State Management: Centralized in
state.jswith event notifications - Module Communication: Through
events.jsevent system - Feature Organization: Domain-based folders (
mapping/,reconciliation/) - Layer Separation:
core/(business logic) vsui/(interface) - Workflow Steps: Sequential processing through 5 main steps
- Purpose: Application entry point, initializes all modules
- Key exports:
initializeApp() - Dependencies: All step modules, state, navigation, events
- Purpose: Centralized state management with persistence
- Key exports:
setupState(), convenience methods likeupdateMappings(),incrementReconciliationCompleted(),linkItemToWikidata(),unlinkItem(),getLinkedItem() - Dependencies: events.js
- Purpose: Inter-module communication via events
- Key exports:
eventSystem(emit, on, off methods) - Dependencies: None (foundational)
- Purpose: Controls workflow step progression and validation
- Key exports:
setupNavigation(), step validation logic - Dependencies: state.js, events.js
- Purpose: Global modal management and display
- Key exports:
setupModals(),openModal(),closeModal() - Dependencies: state.js, ui/modal-ui.js
- Purpose: Step 1 - Import data from Omeka S API
- Key features: API authentication, data fetching, sample display
- Dependencies: utils/cors-proxy.js, data/mock-data.js
- Purpose: Step 2 - Map Omeka fields to Wikidata properties
- Key features: Field analysis, property search, transformation setup
- Dependencies: mapping/*, transformations.js, api/wikidata.js
- Purpose: Step 3 - Match entities with Wikidata items
- Key features: Batch processing, entity matching, progress tracking
- Dependencies: reconciliation/*, api/wikidata.js
- Purpose: Step 4 - Detect and display reference links
- Key features: Automatic reference detection, display with counts and examples
- Dependencies: references/core/detector.js, references/ui/display.js, events.js
- Purpose: Step 5 - Generate QuickStatements for Wikidata import
- Key features: QuickStatements generation, batch export
- Dependencies: state.js, reconciliation data
data-analyzer.js
- Purpose: Analyze Omeka data structure and extract fields
- Key exports:
extractAndAnalyzeKeys(),extractAvailableFields(),extractSampleValue()
property-searcher.js
- Purpose: Search and suggest Wikidata properties
- Key exports:
searchWikidataProperties(),getAutoSuggestions(),selectProperty()
constraint-validator.js
- Purpose: Validate and display property constraints
- Key exports:
displayPropertyConstraints(),createConstraintsSection()
transformation-engine.js
- Purpose: Execute value transformations
- Key exports:
applyTransformations(),createTransformationPipeline()
mapping-persistence.js
- Purpose: Save/load mapping configurations
- Key exports:
generateMappingData(),downloadMappingAsJson(),loadMappingFromData()
mapping-lists.js
- Purpose: Manage mapping UI lists (non-linked, mapped, ignored)
- Key exports:
populateLists(),moveKeyToCategory(),mapKeyToProperty()
transformation-ui.js
- Purpose: UI for transformation configuration
- Key exports:
renderTransformationBlocks(),updateTransformationPreview()
property-modals.js
- Purpose: Property configuration modals
- Key exports:
openPropertyModal(),updatePropertyConfiguration()
constraint-ui.js
- Purpose: Display constraint information in UI
- Key exports:
renderConstraints(),formatConstraintDisplay()
mapping-modal.js- Main mapping configuration modaladd-property-modal.js- Add manual propertiesmanual-property-modal.js- Configure manual property valuesjson-modal.js- Import/export JSON configurationsmodal-helpers.js- Shared modal utilities
entity-matcher.js
- Purpose: Match items with Wikidata entities
- Key exports:
reconcileEntity(),searchWikidataEntities(),scoreMatch()
batch-processor.js
- Purpose: Process reconciliation in batches
- Key exports:
processBatch(),createBatchQueue(),updateBatchProgress()
reconciliation-data.js
- Purpose: Manage reconciliation data and results
- Key exports:
storeReconciliationResult(),getReconciliationStatus()
reconciliation-progress.js
- Purpose: Track reconciliation progress
- Key exports:
updateProgress(),calculateCompletion(),getProgressStats()
reconciliation-table.js
- Purpose: Display reconciliation results in table
- Key exports:
renderReconciliationTable(),updateTableRow(),updateItemCellDisplay() - Features: Item cell with link button to link items to existing Wikidata items
reconciliation-modal.js
- Purpose: Reconciliation configuration and details modal
- Key exports:
openReconciliationModal(),displayMatchDetails()
reconciliation-display.js
- Purpose: Format and display reconciliation information
- Key exports:
formatReconciliationStatus(),displayMatchScore()
validation-engine.js
- Purpose: Enhanced validation system for string properties and external identifiers
- Key exports:
extractRegexConstraints(),validateStringValue(),validateRealTime(),searchWikidataLanguages()
modal-factory.js
- Purpose: Central factory for creating reconciliation modals by data type
- Key exports:
createReconciliationModalByType(),initializeReconciliationModal(),isModalTypeSupported() - Supported types: wikibase-item, string, time, monolingualtext, external-id, url
wikidata-item-modal.js
- Purpose: Wikidata entity reconciliation modal interface
- Key exports:
createWikidataItemModal(),initializeWikidataItemModal()
string-modal.js
- Purpose: String and monolingual text reconciliation modal interface
- Key exports:
createStringModal(),initializeStringModal()
time-modal.js
- Purpose: Point-in-time (date) reconciliation modal with precision detection
- Key exports:
createTimeModal(),initializeTimeModal()
external-id-modal.js
- Purpose: External identifier validation modal with regex constraints
- Key exports:
createExternalIdModal(),initializeExternalIdModal() - Features: Real-time regex validation, user override capability, property constraint display
url-modal.js
- Purpose: URL validation modal with testing functionality
- Key exports:
createUrlModal(),initializeUrlModal() - Features: Real-time URL validation, test URL button, user override capability, pattern constraint display
link-item-modal.js
- Purpose: Link items to existing Wikidata items instead of creating new ones
- Key exports:
createLinkItemModal(),initializeLinkItemModal() - Features: Search Wikidata items, display results with label/QID/description, select to link
- Impact: Linked items generate UPDATE statements instead of CREATE in export
detector.js
- Purpose: Detect reference links from Omeka S API data
- Key exports:
detectReferences(),detectOmekaItemLink(),detectOCLCLinks(),detectARKIdentifiers(),detectGenericSameAsReferences(),getReferenceTypeLabel(),getReferenceTypeDescription() - Reference types: Omeka API Item links, OCLC WorldCat links, ARK identifiers, Generic sameAs links
- Returns: Item-specific references with summary statistics and base URLs
custom-references.js
- Purpose: Manage user-created custom references
- Key exports:
createCustomReference(),validateCustomReference(),convertAutoDetectedToEditable(),getDisplayBaseUrl() - Features: Create and validate custom references, convert auto-detected to editable format
display.js
- Purpose: Render reference detection results with counts, tooltips, and editing capabilities
- Key exports:
renderReferencesSection(),createReferenceListItem(),createCustomReferenceListItem(),createTooltip() - Features: Reference list with selection/ignore toggle, position-preserved custom replacements, base URL display
custom-reference-modal.js
- Purpose: Modal interface for adding and editing custom references
- Key exports:
openCustomReferenceModal() - Features: Item-specific URL inputs, pre-filled editing, complete data preservation
mapping/index.js- Re-exports all mapping module functionsreconciliation/index.js- Re-exports all reconciliation functions
- Purpose: Data transformation engine
- Key exports:
BLOCK_TYPES,applyTransformation(),applyTransformationChain(),createTransformationBlock() - Features: Regex, find/replace, prefix/suffix, compose, split/join
- Purpose: Wikidata API interface with caching
- Key exports:
getPropertyInfo(),getPropertyConstraints(),fetchEntityLabels(),getCompletePropertyData() - Features: Request caching, batch fetching, error handling
- Purpose: Handle CORS issues with external APIs
- Key exports:
fetchWithCorsProxy(),getCorsExplanation(),generateCorsConfig()
- Purpose: Property type detection and input handling
- Key exports:
detectPropertyType(),createInputHTML(),validateInput(),detectDatePrecision()
- Purpose: Property constraint analysis
- Key exports:
getConstraintBasedTypes(),validateAgainstFormatConstraints(),scoreMatchWithConstraints()
- Purpose: Factory functions for creating DOM elements
- Key exports:
createElement(),createButton(),createInput(),createModal(),showMessage() - Note: ALWAYS use these instead of
document.createElement()
- Purpose: Modal window management
- Key exports:
createModalContainer(),showModal(),closeModal()
- Purpose: Generate modal content
- Key exports:
getMappingModalContent(),getReconciliationModalContent()
- Purpose: Navigation interface elements
- Key exports:
setupNavigationUI(),updateStepIndicator()
- Purpose: Project save/load modal content
- Key exports:
getSaveProjectModalContent(),getLoadProjectModalContent()
- Purpose: Test data for development
- Key exports:
getMockItemsData(),getMockMappingData(),getMockReconciliationData()
Experimental features and standalone utilities:
api/fetch.js- API fetching experimentsui/- UI component prototypesutils/- Utility function experiments- Note: Not part of main application flow
- Add type to
BLOCK_TYPESintransformations.js - Add metadata to
BLOCK_METADATA - Implement transformation logic in
applyTransformation() - Add UI rendering in
mapping/ui/transformation-ui.js
- Edit
api/wikidata.js - Update caching logic if needed
- Handle errors consistently with existing patterns
- Create new file in
steps/ - Export
setup[StepName]Step(state)function - Import and initialize in
app.js - Add navigation logic in
navigation.js - Update step count in navigation UI
- Create content generator in appropriate
ui/file - Register modal handler in
modals.js - Emit event to open:
eventSystem.emit('modal:open', {...})
- Add to
initialStateinstate.js - Create convenience methods if needed
- Emit appropriate events on changes
- Update persistence logic if needed
app.js
├── state.js ←── events.js
├── navigation.js
├── modals.js
└── steps/
├── input.js ←── utils/cors-proxy.js
├── mapping.js ←── mapping/* + transformations.js
├── reconciliation.js ←── reconciliation/*
├── step4.js ←── references/*
└── export.js
api/wikidata.js ← used by mapping & reconciliation
ui/components.js ← used by all UI modules
- Maximum 1000 lines per JavaScript file
- Split large modules into
core/andui/subdirectories - Use index.js files to re-export public APIs