CUTR-at-USF / muser-firebase-export

Exports data collected with the MUSER Android app (https://github.com/CUTR-at-USF/MUSER) from Firebase
Apache License 2.0
0 stars 3 forks source link

Handle the new data format change #3

Closed BumbleFlash closed 3 years ago

BumbleFlash commented 3 years ago

Per discussion to our meeting, we have gone ahead and added three new UI events PLAY_ALBUM, PLAY_ALBUM_ARTIST, and PLAY_GENRE each of them having a new model class AlbumData, AlbumArtistData, GenreData. Only one of them is populated at a time and while the other is null. You may want to handle the null cases and populate data accordingly

AlbumArtistData class looks like this:

val name: String,
val albumData: List<AlbumData>

AlbumData class looks like this:

val id: Long,
val name: String,
val artists: List<Artist>,
val albumArtistName: String,
val year: Int,
val numSongs: Int,
val numDiscs: Int,
val dateAdded: Long,
val paths: List<String>

Artist looks like this:

public long id;
public String name;
public int numAlbums;
public int numSongs;

Genre looks like this:

val id: Long,
val name: String,
val numSongs: Int
barbeau commented 3 years ago

Thanks for opening this @BumbleFlash. As we work on the tool, we need to keep in mind that we will continuously add data to be collected, so we need to make sure the export tool is robust enough to handle this. So we should be able to run the tool and export all records, even if some of them are null. So as @BumbleFlash says, you may need to null check variables to make sure the application handles the case where that variable doesn't exist. This is typical in No-SQL databases like Firebase when you don't have a well-defined schema and fields can change over time.

pradeepsalunke commented 3 years ago

Thanks for adding the schema. From database I'm getting a object named albumArtist Can you provide the properties of that object

pradeepsalunke commented 3 years ago

Hi @BumbleFlash As mentioned above AlbumData is a property of AlbumArtistData class. But If you see the database it doest not follow the class hierarchy AlbumData and AlbumArtistData are a part of Main class. for e.g if you check user ""izHkj6cCdDcF6EMZ9XG5xXIClZl1" and its ui-event id "51-dd2f09b8-7b4b-49d6-bc42-4d405e9a7d1b".

pradeepsalunke commented 3 years ago

For Genre data : Im getting numSongs as well as numSong Which one should I use?

BumbleFlash commented 3 years ago

@pradeepsalunke I'd store whatever you get from the Firebase Firestore as is. You can differentiate with different models of data using the traditional null checks or just checking what type of UiEvent it is. For example, PLAY_ALBUM_ARTIST will always populate the AlbumArtist parameter.

BumbleFlash commented 3 years ago

For Genre data : Im getting numSongs as well as numSong Which one should I use?

@pradeepsalunke I don't understand how you're getting two numSongs. Could you please give me the UID and record_ID for the PLAY_GENRE event that's having two numSongs?

BumbleFlash commented 3 years ago

But If you see the database it doest not follow the class hierarchy AlbumData and AlbumArtistData are a part of Main class. for e.g if you check

The AlbumData class is populated when we capture a PLAY_ALBUM event and the AlbumArtistData class is populated when we capture PLAY_ALBUM_ARTIST event. The primary purpose of the AlbumArtistData class would be to store the artist's name with the list of albums published under their name, while the AlbumData class would store the details of the album.

I didn't quite understand what you were trying to say but I hope this clears things up. Feel free to reach out if you had any further questions.