Skip to content

Commit

Permalink
Hospitals: added support for care unit capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
lukarenko committed Oct 10, 2020
1 parent eee0172 commit 1beabb1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ In case of failures a notification is set to slack channel #alert through Data A

## Changelog

## 1.5.23

- Hospitals: added support for care unit capacity

## 1.5.22

- Remove hospital (SB NG)
Expand Down
19 changes: 18 additions & 1 deletion sources/SloCovidServer/SloCovidServer/Models/HospitalsDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public class HospitalDay
public HospitalBedDay Beds { get; }
public HospitalICUDay ICU { get; }
public HospitalVentDay Vents { get; }
public HospitalDay(HospitalBedDay beds, HospitalICUDay iCU, HospitalVentDay vents)
public HospitalCareDay Care { get; }
public HospitalDay(HospitalBedDay beds, HospitalICUDay iCU, HospitalVentDay vents, HospitalCareDay care)
{
Beds = beds;
ICU = iCU;
Vents = vents;
Care = care;
}
}

Expand Down Expand Up @@ -77,4 +79,19 @@ public HospitalVentDay(int? total, int? max, int? occupied, int? free)
Free = free;
}
}

public class HospitalCareDay
{
public int? Total { get; }
public int? Max { get; }
public int? Occupied { get; }
public int? Free { get; }
public HospitalCareDay(int? total, int? max, int? occupied, int? free)
{
Total = total;
Max = max;
Occupied = occupied;
Free = free;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ HospitalDay GetHospitalDay(string hospital, ImmutableDictionary<string, int> hea
return new HospitalDay(
GetHospitalBeds(hospital, header, fields),
GetHospitalICUs(hospital, header, fields),
GetHospitalVents(hospital, header, fields)
GetHospitalVents(hospital, header, fields),
GetHospitalCare(hospital, header, fields)
);
}

Expand Down Expand Up @@ -292,6 +293,16 @@ HospitalVentDay GetHospitalVents(string hospital, ImmutableDictionary<string, in
GetInt($"hospital{location}.vent.free", header, fields, isMandatory: false)
);
}
HospitalCareDay GetHospitalCare(string hospital, ImmutableDictionary<string, int> header, IImmutableList<string> fields)
{
string location = !string.IsNullOrEmpty(hospital) ? $".{hospital}" : "";
return new HospitalCareDay(
GetInt($"hospital{location}.care.total", header, fields, isMandatory: false),
GetInt($"hospital{location}.care.total.max", header, fields, isMandatory: false),
GetInt($"hospital{location}.care.occupied", header, fields, isMandatory: false),
GetInt($"hospital{location}.care.free", header, fields, isMandatory: false)
);
}

RegionsDay GetDailyRegionFromRaw(ImmutableDictionary<string, int> header, string line)
{
Expand Down
2 changes: 1 addition & 1 deletion version.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<version>1.5.22</version>
<version>1.5.23</version>

0 comments on commit 1beabb1

Please sign in to comment.