198 lines
4.1 KiB
Dart
198 lines
4.1 KiB
Dart
/// Data models for dashboard and dossier pages
|
|
|
|
class DossierStats {
|
|
final int imaging;
|
|
final int labs;
|
|
final bool genome;
|
|
final int documents;
|
|
final int vitals;
|
|
final int medications;
|
|
final int supplements;
|
|
|
|
const DossierStats({
|
|
this.imaging = 0,
|
|
this.labs = 0,
|
|
this.genome = false,
|
|
this.documents = 0,
|
|
this.vitals = 0,
|
|
this.medications = 0,
|
|
this.supplements = 0,
|
|
});
|
|
|
|
bool get hasAnyData =>
|
|
imaging > 0 ||
|
|
labs > 0 ||
|
|
genome ||
|
|
documents > 0 ||
|
|
vitals > 0 ||
|
|
medications > 0 ||
|
|
supplements > 0;
|
|
}
|
|
|
|
class DossierSummary {
|
|
final String id;
|
|
final String name;
|
|
final String? dateOfBirth;
|
|
final String? sex;
|
|
final String? relation;
|
|
final bool isSelf;
|
|
final bool isCareReceiver;
|
|
final bool canEdit;
|
|
final DossierStats stats;
|
|
|
|
const DossierSummary({
|
|
required this.id,
|
|
required this.name,
|
|
this.dateOfBirth,
|
|
this.sex,
|
|
this.relation,
|
|
this.isSelf = false,
|
|
this.isCareReceiver = false,
|
|
this.canEdit = false,
|
|
this.stats = const DossierStats(),
|
|
});
|
|
}
|
|
|
|
class DataItem {
|
|
final String value;
|
|
final String? summary;
|
|
final String? date;
|
|
final String? type;
|
|
|
|
const DataItem({
|
|
required this.value,
|
|
this.summary,
|
|
this.date,
|
|
this.type,
|
|
});
|
|
}
|
|
|
|
class ImagingSeries {
|
|
final String id;
|
|
final String? description;
|
|
final String modality;
|
|
final int sliceCount;
|
|
|
|
const ImagingSeries({
|
|
required this.id,
|
|
this.description,
|
|
required this.modality,
|
|
required this.sliceCount,
|
|
});
|
|
}
|
|
|
|
class ImagingStudy {
|
|
final String id;
|
|
final String description;
|
|
final String date;
|
|
final List<ImagingSeries> series;
|
|
|
|
const ImagingStudy({
|
|
required this.id,
|
|
required this.description,
|
|
required this.date,
|
|
required this.series,
|
|
});
|
|
|
|
int get seriesCount => series.length;
|
|
}
|
|
|
|
class GeneticVariant {
|
|
final String rsid;
|
|
final String? gene;
|
|
final String genotype;
|
|
final double? magnitude;
|
|
final String? summary;
|
|
final String category;
|
|
|
|
const GeneticVariant({
|
|
required this.rsid,
|
|
this.gene,
|
|
required this.genotype,
|
|
this.magnitude,
|
|
this.summary,
|
|
required this.category,
|
|
});
|
|
|
|
String get formattedAllele {
|
|
final letters = genotype.replaceAll(';', '');
|
|
return letters.split('').join(';');
|
|
}
|
|
}
|
|
|
|
class GeneticCategory {
|
|
final String name;
|
|
final int shown;
|
|
final int hidden;
|
|
|
|
const GeneticCategory({
|
|
required this.name,
|
|
required this.shown,
|
|
this.hidden = 0,
|
|
});
|
|
|
|
int get total => shown + hidden;
|
|
|
|
String get displayName =>
|
|
name.substring(0, 1).toUpperCase() +
|
|
name.substring(1).replaceAll('_', ' ');
|
|
}
|
|
|
|
class AccessEntry {
|
|
final String dossierID;
|
|
final String name;
|
|
final String relation;
|
|
final bool canEdit;
|
|
final bool isSelf;
|
|
final bool isPending;
|
|
|
|
const AccessEntry({
|
|
required this.dossierID,
|
|
required this.name,
|
|
required this.relation,
|
|
this.canEdit = false,
|
|
this.isSelf = false,
|
|
this.isPending = false,
|
|
});
|
|
}
|
|
|
|
class DossierData {
|
|
final DossierSummary dossier;
|
|
final List<ImagingStudy> studies;
|
|
final List<DataItem> labs;
|
|
final List<DataItem> documents;
|
|
final List<DataItem> procedures;
|
|
final List<DataItem> assessments;
|
|
final List<DataItem> medications;
|
|
final List<DataItem> symptoms;
|
|
final List<DataItem> hospitalizations;
|
|
final List<DataItem> therapies;
|
|
final List<GeneticCategory> geneticCategories;
|
|
final List<AccessEntry> accessList;
|
|
final int uploadCount;
|
|
final String uploadSize;
|
|
final bool hasGenome;
|
|
final bool canEdit;
|
|
final bool canManageAccess;
|
|
|
|
const DossierData({
|
|
required this.dossier,
|
|
this.studies = const [],
|
|
this.labs = const [],
|
|
this.documents = const [],
|
|
this.procedures = const [],
|
|
this.assessments = const [],
|
|
this.medications = const [],
|
|
this.symptoms = const [],
|
|
this.hospitalizations = const [],
|
|
this.therapies = const [],
|
|
this.geneticCategories = const [],
|
|
this.accessList = const [],
|
|
this.uploadCount = 0,
|
|
this.uploadSize = '0 KB',
|
|
this.hasGenome = false,
|
|
this.canEdit = false,
|
|
this.canManageAccess = false,
|
|
});
|
|
}
|