How avniproject/avni-models works
Main Components
a. Core Domain Models Layer:
• Related entities into logical clusters:
• Subject Management (Individual.js, Family.js, SubjectType.js)
• Clinical (Encounter.js, ProgramEncounter.js, ProgramEnrolment.js)
• Observation Models (Observation.js, ObservationsHolder.js)
• Metadata (EntityMetaData.js, Schema.js)
• Rules Engine (Rule.js, EntityRule.js, RuleDependency.js)
b. Application Layer:
• Forms Subsystem (application/Form.js, FormElement.js, FormMapping.js)
• Workflow Management (WorkItem.js, WorkList.js)
• Dashboard & Reporting (Dashboard.js, ReportCard.js)
c. Framework Layer:
• Realm Database Integration (framework/RealmProxy.js, RealmObjectSchema.js)
• Utility Services (utility/*)
[Frontend Clients]
• ↓
[Models Package Interface (index.js)]
• ↓
┌─────────────────────────────────────┐
• Domain Models │
• ┤
• • Subject Domain │
• • Clinical Domain │
• • Observation Domain │
• • Metadata Management │
• ┘
• ↕
┌─────────────────────────────────────┐
• Application Layer │
• ┤
• • Forms Management │
• • Work Management │
• • Reporting & Analytics │
• ┘
• ↕
┌─────────────────────────────────────┐
• Framework Layer │
• ┤
• • Realm DB Integration │
• • Utility Services │
• ┘
Important Details to Highlight
a. Entity Relationships:
• Inheritance from BaseEntity.js
• Relationships between clinical entities (Program → ProgramEnrolment → ProgramEncounter)
• Form structure relationships
b. Cross-Cutting Concerns:
• Sync functionality (EntitySyncStatus.js)
• Validation system (ValidationResults.js)
• Translation/localization (Translation.js, LocaleMapping.js)
Notes for Implementation
• Use standard UML notation where appropriate
• Version information
• Document sync/persistence capabilities