Add comprehensive system documentation with ERD, DFD, flowmaps, UML diagrams and folder structure#23
Add comprehensive system documentation with ERD, DFD, flowmaps, UML diagrams and folder structure#23
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: nirwanadoteth <121574317+nirwanadoteth@users.noreply.github.com>
Co-authored-by: nirwanadoteth <121574317+nirwanadoteth@users.noreply.github.com>
|
@copilot Buat narasi yang menggambarkan arsitektur sistem (MVVM?) yang digunakan secara umum (1 atau 2 paragraf), lalu buatkan juga Diagram UML yang mencakup Class Diagram, Use Case Diagram, Activity Diagram, dan Sequence Diagram. |
…ctivity, Sequence) Co-authored-by: nirwanadoteth <121574317+nirwanadoteth@users.noreply.github.com>
Sudah ditambahkan di commit 2bfe5cb: Narasi Arsitektur MVVM (2 paragraf):
Diagram UML yang ditambahkan:
Total 6 diagram UML baru ditambahkan ke DIAGRAMS.md (file bertambah dari 863 ke 1465 baris). |
Co-authored-by: nirwanadoteth <121574317+nirwanadoteth@users.noreply.github.com>
|
@coderabbitai tolong buatkan class diagram untuk repositori ini |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
🏁 Script executed: Length of output: 2036 🏁 Script executed: Length of output: 804 🏁 Script executed: Length of output: 507 🏁 Script executed: Length of output: 144 🏁 Script executed: Length of output: 73 🏁 Script executed: Length of output: 118 🏁 Script executed: Length of output: 134 🏁 Script executed: Length of output: 452 🏁 Script executed: Length of output: 415 🏁 Script executed: Length of output: 532 🏁 Script executed: Length of output: 1695 🏁 Script executed: Length of output: 4083 🏁 Script executed: Length of output: 3239 🏁 Script executed: Length of output: 5229 🏁 Script executed: Length of output: 2258 🏁 Script executed: Length of output: 378 🏁 Script executed: Length of output: 635 🏁 Script executed: Length of output: 4384 🏁 Script executed: Length of output: 4236 🏁 Script executed: Length of output: 2128 🏁 Script executed: Length of output: 7579
classDiagram
%% ============================================
%% APPLICATION LAYER
%% ============================================
class HerbaAppApplication {
<<Application>>
+onCreate()
}
%% ============================================
%% PRESENTATION LAYER - VIEW
%% ============================================
class SplashActivity {
<<Activity>>
+onCreate()
-navigateToAuth()
-navigateToMain()
}
class AuthActivity {
<<Activity>>
+onCreate()
-setupNavigation()
}
class MainActivity {
<<Activity>>
+onCreate()
-setupBottomNavigation()
-setupFragments()
}
class LoginFragment {
<<Fragment>>
-binding: FragmentLoginBinding
-authViewModel: AuthViewModel
+onViewCreated()
-observeAuthState()
-handleGoogleSignIn()
}
class RegisterFragment {
<<Fragment>>
-binding: FragmentRegisterBinding
-authViewModel: AuthViewModel
+onViewCreated()
-observeAuthState()
}
class ScanFragment {
<<Fragment>>
-binding: FragmentScanBinding
-scanViewModel: ScanViewModel
-imageCapture: ImageCapture
+onViewCreated()
-startCamera()
-takePhoto()
-observeUiState()
}
class ResultFragment {
<<Fragment>>
-binding: FragmentResultBinding
-resultViewModel: ResultViewModel
-analysisResult: AnalysisResult
+onViewCreated()
-displayResult()
-shareToForum()
}
class ForumFragment {
<<Fragment>>
-binding: FragmentForumBinding
-forumViewModel: ForumViewModel
-postAdapter: PostAdapter
+onViewCreated()
-observePosts()
-handleLike()
}
class ProfileFragment {
<<Fragment>>
-binding: FragmentProfileBinding
-profileViewModel: ProfileViewModel
-postAdapter: PostAdapter
+onViewCreated()
-observeUserData()
-observeUserPosts()
-handleLogout()
}
class HistoryFragment {
<<Fragment>>
-binding: FragmentHistoryBinding
-historyViewModel: HistoryViewModel
-historyAdapter: HistoryAdapter
+onViewCreated()
-observeHistory()
}
class HistoryDetailFragment {
<<Fragment>>
-binding: FragmentHistoryDetailBinding
-historyDetailViewModel: HistoryDetailViewModel
-scanHistory: ScanHistory
+onViewCreated()
-displayDetails()
-handleDelete()
}
class ProcessingDialogFragment {
<<DialogFragment>>
+onCreateDialog()
}
%% ============================================
%% PRESENTATION LAYER - ADAPTERS
%% ============================================
class HistoryAdapter {
<<RecyclerView.Adapter>>
-onClick: (ScanHistory) → Unit
+onCreateViewHolder()
+onBindViewHolder()
-HistoryViewHolder
}
class PostAdapter {
<<RecyclerView.Adapter>>
-onLikeClicked: (String) → Unit
-onDeleteClicked: (Post) → Unit
+onCreateViewHolder()
+onBindViewHolder()
-PostViewHolder
}
%% ============================================
%% PRESENTATION LAYER - VIEWMODELS
%% ============================================
class AuthViewModel {
<<ViewModel>>
-firebaseAuth: FirebaseAuth
-_authState: MutableLiveData~AuthState~
+authState: LiveData~AuthState~
+loginUser(email, password)
+signInWithGoogleToken(idToken)
+registerUser(name, email, password, confirmPassword)
}
class ScanViewModel {
<<ViewModel>>
-analyzePlantUseCase: AnalyzePlantUseCase
-_uiState: MutableLiveData~UiState~
+uiState: LiveData~UiState~
-_navigateToResult: MutableLiveData~AnalysisResult~
+navigateToResult: LiveData~AnalysisResult~
+analyzeImage(bitmap: Bitmap)
+onNavigationComplete()
}
class ResultViewModel {
<<ViewModel>>
-postRepository: PostRepository
-auth: FirebaseAuth
-_postResult: MutableLiveData~Result~
+postResult: LiveData~Result~
-_isLoading: MutableLiveData~Boolean~
+isLoading: LiveData~Boolean~
+createPostFromScan(imageUri, plantName, description)
-parsePlantData(text): Map
}
class ForumViewModel {
<<ViewModel>>
-postRepository: PostRepository
-auth: FirebaseAuth
-_posts: MutableLiveData~List~Post~~
+posts: LiveData~List~Post~~
-_isLoading: MutableLiveData~Boolean~
+isLoading: LiveData~Boolean~
-_error: MutableLiveData~String~
+error: LiveData~String~
-fetchPosts()
+toggleLikeOnPost(postId)
+deletePost(post)
}
class ProfileViewModel {
<<ViewModel>>
-auth: FirebaseAuth
-postRepository: PostRepository
-_user: MutableLiveData~FirebaseUser~
+user: LiveData~FirebaseUser~
-_userPosts: MutableLiveData~List~Post~~
+userPosts: LiveData~List~Post~~
-fetchUserPosts()
+toggleLikeOnPost(postId)
+deletePost(post)
+logout()
}
class HistoryViewModel {
<<ViewModel>>
-plantRepository: PlantRepository
+allHistory: LiveData~List~ScanHistory~~
}
class HistoryDetailViewModel {
<<ViewModel>>
-plantRepository: PlantRepository
+deleteHistory(history)
}
%% ============================================
%% PRESENTATION LAYER - STATE CLASSES
%% ============================================
class UiState {
<<sealed class>>
}
class UiStateIdle {
<<object>>
}
class UiStateLoading {
<<object>>
}
class UiStateSuccess {
<<object>>
}
class UiStateError {
<<data class>>
+message: String
}
class AuthState {
<<sealed class>>
}
class AuthStateIdle {
<<object>>
}
class AuthStateLoading {
<<object>>
}
class AuthStateAuthenticated {
<<object>>
}
class AuthStateError {
<<data class>>
+message: String
}
%% ============================================
%% DOMAIN LAYER - USE CASES
%% ============================================
class AnalyzePlantUseCase {
<<UseCase>>
-plantRepository: PlantRepository
+invoke(bitmap: Bitmap): Result~AnalysisResult~
}
%% ============================================
%% DATA LAYER - REPOSITORIES
%% ============================================
class PlantRepository {
<<interface>>
+analyzePlant(bitmap, prompt): AnalysisResult
+getAllHistory(): Flow~List~ScanHistory~~
+deleteHistory(history)
}
class PlantRepositoryImpl {
<<Repository>>
-generativeModel: GenerativeModel
-scanHistoryDao: ScanHistoryDao
-application: Application
+analyzePlant(bitmap, prompt): AnalysisResult
+getAllHistory(): Flow~List~ScanHistory~~
+deleteHistory(history)
-saveBitmapToFile(bitmap): String
}
class PostRepository {
<<Repository>>
-firestore: FirebaseFirestore
+getPosts(): Flow~List~Post~~
+getPostsByUserId(userId): Flow~List~Post~~
+createPost(userId, username, userProfilePictureUrl, imageUri, plantName, description, parsedData)
+toggleLike(postId, userId)
+deletePost(post)
-uploadImageToCloudinary(imageUri): String
}
%% ============================================
%% DATA LAYER - LOCAL DATA SOURCES
%% ============================================
class AppDatabase {
<<RoomDatabase>>
+scanHistoryDao(): ScanHistoryDao
}
class ScanHistoryDao {
<<DAO>>
+insertHistory(scanHistory)
+getAllHistory(): Flow~List~ScanHistory~~
+deleteHistory(scanHistory)
}
%% ============================================
%% DATA LAYER - ENTITIES & MODELS
%% ============================================
class ScanHistory {
<<Entity>>
+id: Int
+resultText: String
+imagePath: String
+timestamp: Long
}
class Post {
<<Data Class>>
+id: String
+userId: String
+username: String
+userProfilePictureUrl: String?
+imageUrl: String
+plantName: String
+description: String
+timestamp: Long
+likes: List~String~
+content: String?
+benefit: String?
+warning: String?
}
class AnalysisResult {
<<Data Class>>
+resultText: String
+imagePath: String
}
%% ============================================
%% DATA LAYER - EXTERNAL SERVICES
%% ============================================
class FirebaseAuth {
<<External Service>>
+signInWithEmailAndPassword()
+signInWithCredential()
+createUserWithEmailAndPassword()
+signOut()
+currentUser: FirebaseUser?
}
class FirebaseFirestore {
<<External Service>>
+collection(path): CollectionReference
}
class GenerativeModel {
<<External Service - Gemini AI>>
+generateContent(content): GenerateContentResponse
}
class MediaManager {
<<External Service - Cloudinary>>
+upload(uri): RequestUploader
}
%% ============================================
%% DEPENDENCY INJECTION
%% ============================================
class AppModule {
<<Hilt Module>>
+provideFirebaseAuth(): FirebaseAuth
+provideFirebaseFirestore(): FirebaseFirestore
+provideFirebaseStorage(): FirebaseStorage
+provideGenerativeModel(): GenerativeModel
+provideAppDatabase(): AppDatabase
+provideScanHistoryDao(): ScanHistoryDao
+providePlantRepository(): PlantRepository
}
%% ============================================
%% RELATIONSHIPS
%% ============================================
%% Application
HerbaAppApplication ..> AppModule : uses
%% Activities contain Fragments
AuthActivity *-- LoginFragment
AuthActivity *-- RegisterFragment
MainActivity *-- ScanFragment
MainActivity *-- ResultFragment
MainActivity *-- ForumFragment
MainActivity *-- ProfileFragment
MainActivity *-- HistoryFragment
MainActivity *-- HistoryDetailFragment
%% Fragments use ViewModels
LoginFragment --> AuthViewModel : uses
RegisterFragment --> AuthViewModel : uses
ScanFragment --> ScanViewModel : uses
ResultFragment --> ResultViewModel : uses
ForumFragment --> ForumViewModel : uses
ProfileFragment --> ProfileViewModel : uses
HistoryFragment --> HistoryViewModel : uses
HistoryDetailFragment --> HistoryDetailViewModel : uses
%% Fragments use Adapters
ForumFragment --> PostAdapter : uses
ProfileFragment --> PostAdapter : uses
HistoryFragment --> HistoryAdapter : uses
%% ViewModels use UseCases/Repositories
AuthViewModel --> FirebaseAuth : uses
ScanViewModel --> AnalyzePlantUseCase : uses
ResultViewModel --> PostRepository : uses
ResultViewModel --> FirebaseAuth : uses
ForumViewModel --> PostRepository : uses
ForumViewModel --> FirebaseAuth : uses
ProfileViewModel --> PostRepository : uses
ProfileViewModel --> FirebaseAuth : uses
HistoryViewModel --> PlantRepository : uses
HistoryDetailViewModel --> PlantRepository : uses
%% ViewModels use State
ScanViewModel --> UiState : uses
AuthViewModel --> AuthState : uses
%% State inheritance
UiState <|-- UiStateIdle
UiState <|-- UiStateLoading
UiState <|-- UiStateSuccess
UiState <|-- UiStateError
AuthState <|-- AuthStateIdle
AuthState <|-- AuthStateLoading
AuthState <|-- AuthStateAuthenticated
AuthState <|-- AuthStateError
%% UseCases use Repositories
AnalyzePlantUseCase --> PlantRepository : uses
%% Repository implementation
PlantRepository <|.. PlantRepositoryImpl : implements
%% Repositories use DAOs and External Services
PlantRepositoryImpl --> ScanHistoryDao : uses
PlantRepositoryImpl --> GenerativeModel : uses
PostRepository --> FirebaseFirestore : uses
PostRepository --> MediaManager : uses
%% Database provides DAO
AppDatabase --> ScanHistoryDao : provides
%% DAOs work with Entities
ScanHistoryDao --> ScanHistory : CRUD
%% Repositories work with Models
PlantRepository --> AnalysisResult : returns
PlantRepository --> ScanHistory : returns
PostRepository --> Post : returns
%% Adapters work with Models
HistoryAdapter --> ScanHistory : displays
PostAdapter --> Post : displays
%% DI Module provides dependencies
AppModule ..> FirebaseAuth : provides
AppModule ..> FirebaseFirestore : provides
AppModule ..> GenerativeModel : provides
AppModule ..> AppDatabase : provides
AppModule ..> ScanHistoryDao : provides
AppModule ..> PlantRepository : provides
Penjelasan Class Diagram: Class diagram ini menampilkan seluruh struktur kelas dalam aplikasi HerbaMed-Jabar yang diorganisir berdasarkan layer arsitektur:
Diagram ini menunjukkan alur data dan dependencies yang jelas dari View → ViewModel → UseCase → Repository → Data Source, mengikuti prinsip MVVM + Clean Architecture. 🧠 Learnings used |
|
@coderabbitai untuk class diagram itu, apakah bisa hanya class-class yang utama saja, saya rasa versi yang lengkap itu tidak akan muat untuk saya masukkan ke dalam dokumen laporan. |
|
Tip For best results, initiate chat on the files or code changes.
classDiagram
%% ============================================
%% PRESENTATION LAYER - VIEW
%% ============================================
class MainActivity {
<<Activity>>
+onCreate()
-setupBottomNavigation()
}
class ScanFragment {
<<Fragment>>
-scanViewModel: ScanViewModel
+onViewCreated()
-startCamera()
-takePhoto()
}
class ForumFragment {
<<Fragment>>
-forumViewModel: ForumViewModel
+onViewCreated()
-observePosts()
}
class HistoryFragment {
<<Fragment>>
-historyViewModel: HistoryViewModel
+onViewCreated()
-observeHistory()
}
%% ============================================
%% PRESENTATION LAYER - VIEWMODELS
%% ============================================
class AuthViewModel {
<<ViewModel>>
-firebaseAuth: FirebaseAuth
+loginUser(email, password)
+registerUser(name, email, password)
+signInWithGoogleToken(idToken)
}
class ScanViewModel {
<<ViewModel>>
-analyzePlantUseCase: AnalyzePlantUseCase
+analyzeImage(bitmap: Bitmap)
}
class ForumViewModel {
<<ViewModel>>
-postRepository: PostRepository
+fetchPosts()
+toggleLikeOnPost(postId)
+deletePost(post)
}
class HistoryViewModel {
<<ViewModel>>
-plantRepository: PlantRepository
+getAllHistory()
}
%% ============================================
%% DOMAIN LAYER - USE CASES
%% ============================================
class AnalyzePlantUseCase {
<<UseCase>>
-plantRepository: PlantRepository
+invoke(bitmap: Bitmap): AnalysisResult
}
%% ============================================
%% DATA LAYER - REPOSITORIES
%% ============================================
class PlantRepository {
<<Repository>>
-generativeModel: GenerativeModel
-scanHistoryDao: ScanHistoryDao
+analyzePlant(bitmap, prompt): AnalysisResult
+getAllHistory(): Flow
+deleteHistory(history)
}
class PostRepository {
<<Repository>>
-firestore: FirebaseFirestore
+getPosts(): Flow
+createPost(...)
+toggleLike(postId, userId)
+deletePost(post)
}
%% ============================================
%% DATA LAYER - DATABASE
%% ============================================
class AppDatabase {
<<RoomDatabase>>
+scanHistoryDao(): ScanHistoryDao
}
class ScanHistoryDao {
<<DAO>>
+insertHistory(scanHistory)
+getAllHistory(): Flow
+deleteHistory(scanHistory)
}
%% ============================================
%% DATA LAYER - ENTITIES
%% ============================================
class ScanHistory {
<<Entity>>
+id: Int
+resultText: String
+imagePath: String
+timestamp: Long
}
class Post {
<<DataClass>>
+id: String
+userId: String
+imageUrl: String
+plantName: String
+description: String
+likes: List
}
class AnalysisResult {
<<DataClass>>
+resultText: String
+imagePath: String
}
%% ============================================
%% EXTERNAL SERVICES
%% ============================================
class FirebaseAuth {
<<ExternalService>>
}
class FirebaseFirestore {
<<ExternalService>>
}
class GenerativeModel {
<<ExternalService>>
}
%% ============================================
%% RELATIONSHIPS
%% ============================================
MainActivity *-- ScanFragment
MainActivity *-- ForumFragment
MainActivity *-- HistoryFragment
ScanFragment --> ScanViewModel
ForumFragment --> ForumViewModel
HistoryFragment --> HistoryViewModel
AuthViewModel --> FirebaseAuth
ScanViewModel --> AnalyzePlantUseCase
ForumViewModel --> PostRepository
HistoryViewModel --> PlantRepository
AnalyzePlantUseCase --> PlantRepository
PlantRepository --> GenerativeModel
PlantRepository --> ScanHistoryDao
PlantRepository --> AnalysisResult
PostRepository --> FirebaseFirestore
PostRepository --> Post
AppDatabase --> ScanHistoryDao
ScanHistoryDao --> ScanHistory
Perbedaan dengan versi lengkap:
Versi ini tetap menunjukkan arsitektur MVVM + Clean Architecture dengan jelas namun lebih ringkas dan cocok untuk dokumentasi laporan. 🧠 Learnings used |
|
@coderabbitai berikan deskripsi singkat untuk disisipkan setelah gambar (1 paragraf, 1-2 kalimat). Contoh (utk diagram activity) seperti ini: |
|
Tip For best results, initiate chat on the files or code changes.
"Diagram kelas di atas menunjukkan struktur utama aplikasi yang mengikuti arsitektur MVVM + Clean Architecture, di mana setiap layer (View, ViewModel, Domain, Repository) memiliki tanggung jawab yang terpisah dengan alur data yang jelas dari UI hingga data source. Fragment-fragment menggunakan ViewModel untuk business logic, ViewModel menggunakan Use Case dan Repository, sementara Repository berinteraksi dengan database lokal (Room) dan services eksternal (Firebase, Gemini AI)." 🧠 Learnings used |
|
@coderabbitai persingkat lagi! |
|
Tip For best results, initiate chat on the files or code changes.
"Diagram menunjukkan arsitektur MVVM aplikasi dengan alur data dari View → ViewModel → Repository → Data Source (Room, Firebase, Gemini AI)." 🧠 Learnings used |
|
@copilot @coderabbitai gambar stuktur folder path app/src/main/java/edu/unikom/herbamedjabar |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
🏁 Script executed: Length of output: 949 🏁 Script executed: Length of output: 452 🏁 Script executed: Length of output: 2489
graph TB
root["📁 herbamedjabar"]
root --> app["📄 HerbaAppApplication.kt"]
root --> adapter["📁 adapter"]
adapter --> adapter1["📄 HistoryAdapter.kt"]
adapter --> adapter2["📄 PostAdapter.kt"]
root --> dao["📁 dao"]
dao --> dao1["📄 ScanHistoryDao.kt"]
root --> data["📁 data"]
data --> data1["📄 Post.kt"]
data --> data2["📄 ScanHistory.kt"]
root --> db["📁 db"]
db --> db1["📄 AppDatabase.kt"]
root --> di["📁 di"]
di --> di1["📄 AppModule.kt"]
root --> repo["📁 repository"]
repo --> repo1["📄 PlantRepository.kt"]
repo --> repo2["📄 PostRepository.kt"]
root --> usecase["📁 useCase"]
usecase --> usecase1["📄 AnalyzePlantUseCase.kt"]
root --> view["📁 view"]
view --> view1["📄 AuthActivity.kt"]
view --> view2["📄 ForumFragment.kt"]
view --> view3["📄 HistoryDetailFragment.kt"]
view --> view4["📄 HistoryFragment.kt"]
view --> view5["📄 LoginFragment.kt"]
view --> view6["📄 MainActivity.kt"]
view --> view7["📄 ProcessingDialogFragment.kt"]
view --> view8["📄 ProfileFragment.kt"]
view --> view9["📄 RegisterFragment.kt"]
view --> view10["📄 ResultFragment.kt"]
view --> view11["📄 ScanFragment.kt"]
view --> view12["📄 SplashActivity.kt"]
root --> vm["📁 viewModel"]
vm --> vm1["📄 AuthViewModel.kt"]
vm --> vm2["📄 ForumViewModel.kt"]
vm --> vm3["📄 HistoryDetailViewModel.kt"]
vm --> vm4["📄 HistoryViewModel.kt"]
vm --> vm5["📄 ProfileViewModel.kt"]
vm --> vm6["📄 ResultViewModel.kt"]
vm --> vm7["📄 ScanViewModel.kt"]
style root fill:`#e1f5ff`
style adapter fill:`#fff4e1`
style dao fill:`#fff4e1`
style data fill:`#fff4e1`
style db fill:`#fff4e1`
style di fill:`#fff4e1`
style repo fill:`#fff4e1`
style usecase fill:`#fff4e1`
style view fill:`#fff4e1`
style vm fill:`#fff4e1`
Deskripsi: Struktur folder aplikasi terorganisir berdasarkan arsitektur MVVM + Clean Architecture dengan 9 folder utama yang masing-masing memiliki tanggung jawab spesifik: 🧠 Learnings used |
…djabar Co-authored-by: nirwanadoteth <121574317+nirwanadoteth@users.noreply.github.com>
Sudah ditambahkan di commit 2711933. Struktur folder untuk path
Total 10 folder dengan 30 file Kotlin tercakup dalam diagram. |
|
@coderabbitai gambarkan seperti list folder (kebawah) |
|
Tip For best results, initiate chat on the files or code changes.
Penjelasan: Struktur folder mengikuti prinsip Clean Architecture dengan separation of concerns: View layer (12 files UI), ViewModel layer (7 files presentation logic), UseCase layer (business logic), Repository layer (data access), Data layer (entities), DAO/DB layer (local database), DI layer (dependency injection), dan Adapter layer (RecyclerView). |
Analyzed the HerbaMed Jabar Android codebase and created complete technical documentation covering system architecture, data flows, and user interactions.
Created Documentation
DIAGRAMS.md (1600 lines, 20 Mermaid diagrams):
Data Model
System Architecture
app/src/main/java/edu/unikom/herbamedjabardirectory structure with text-based tree and color-coded Mermaid diagram showing all 30 Kotlin files across 10 folders organized by architectural layerProcess Flows
UML Diagrams
Technical Details
Updated Files
All diagrams use Mermaid syntax for native GitHub rendering. Documentation written in Indonesian to match codebase language.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.