namespace ClinicalHealthcareManagement

features
    Root
        mandatory
            Patient
                or
                    Demographics {Age Real, Weight Real}
                    MedicalHistory {NumberOfPreviousHospitalizations Integer, LastHospitalizationDate String}
                    Treatments
                        optional
                            Medication {Dosage Real, Frequency Integer}
                            Procedure {Code String, Date String}
                mandatory
                    Insurance
                        or
                            PublicHealthInsurance {Provider "Medicare", CoverageReal}
                            PrivateHealthInsurance {Provider String, Deductible Real}
        optional
            Facility
                or
                    Hospital {Name String, NumberOfBeds Integer}
                        mandatory
                            Department {DepartmentName String, HeadDoctor Name}
                             mandatory
                                Specialty {Code Integer, DoctorsNumber Integer}
                                optional
                                    Staff
                                        or
                                            Doctor {Name, Experience Years}
                                            Nurse {Name, YearsOfService Integer}
                                    Rooms
                                        mandatory
                                            IntensiveCare {NumberInventory Integer, NumberBeds Integer}
                                        optional
                                            StandardRooms {NumberInventory Integer, SquareFeet Real}
                                                mandatory
                                                    Amenities {TVReal, WifiReal}

constraints
    Sum(Demographics.Age) > Avg(MedicalHistory.LastHospitalizationDate.Length)
    TotalCost(PrivateHealthInsurance) + PublicHealthInsurance.Coverage >= Treatments.Dosage * Medication.Frequency
    Max(Department.HeadDoctor.Experience) > Avg(Staff.YearsOfService)
    Count(Specialty, Doctor) == TotalRoomsCount("IntensiveCare", Facility)
    Count(StandardRooms, Nurse) >= Count(StandardRooms, Doctor)
    Min(Department.DoctorsNumber) > Max(Treatments.Dosage) / Average(Medication.Frequency)
    TotalCost(Hospital) <= 10_000_000
    IntensiveCare.NumberInventory + IntensiveCare.NumberBeds >= Rooms.StandardRooms.SquareFeet