Skip to content

Commit

Permalink
* Patients: add red-zone and leadingCovid
Browse files Browse the repository at this point in the history
  • Loading branch information
lukarenko committed Feb 2, 2022
1 parent b9a96f0 commit 6415d89
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ In case of failures a notification is set to slack channel #alert through Data A

## Changelog

## 1.18

* Patients: add red-zone and leadingCovid
* Schema version 47

## 1.17

* Summary: add daily new cases to CasesAvg7Days
Expand Down
17 changes: 11 additions & 6 deletions sources/SloCovidServer/SloCovidServer/Models/PatientsDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public PatientsDay(int dayFromStart, int year, int month, int day, GeneralUnit t
public record GeneralUnit : BaseUnit<StateDeceased>
{
public OutOfHospital OutOfHospital { get; init; }
public GeneralUnit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, StateDeceased deceased, HospitalMovement care, TodayToDate deceasedCare,
OutOfHospital outOfHospital) : base(inHospital, iCU, niv, critical, deceased, care, deceasedCare)
public GeneralUnit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, StateDeceased deceased, HospitalMovement redZone, HospitalMovement care, TodayToDate deceasedCare,
OutOfHospital outOfHospital) : base(inHospital, iCU, niv, critical, deceased, redZone, care, deceasedCare)
{
OutOfHospital = outOfHospital;
}
}
public record Unit : BaseUnit<HospitalDeceased>
{
public Unit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, HospitalDeceased deceased, HospitalMovement care, TodayToDate deceasedCare)
: base(inHospital, iCU, niv, critical, deceased, care, deceasedCare)
public Unit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, HospitalDeceased deceased, HospitalMovement redZone, HospitalMovement care, TodayToDate deceasedCare)
: base(inHospital, iCU, niv, critical, deceased, redZone, care, deceasedCare)
{
}
}
Expand All @@ -45,16 +45,19 @@ public record BaseUnit<TDeceased>
public HospitalMovement NIV { get; init; }
public HospitalMovement Critical { get; init; }
public TDeceased Deceased { get; init; }
public HospitalMovement RedZone { get; init; }
public HospitalMovement Care { get; init; }
public TodayToDate DeceasedCare { get; init; }
public BaseUnit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, TDeceased deceased, HospitalMovement care, TodayToDate deceasedCare)
public BaseUnit(HospitalMovement inHospital, HospitalMovement iCU, HospitalMovement niv, HospitalMovement critical, TDeceased deceased, HospitalMovement redZone, HospitalMovement care, TodayToDate deceasedCare)
{
InHospital = inHospital;
ICU = iCU;
NIV = niv;
Critical = critical;
Deceased = deceased;

RedZone = redZone;

Care = care;
DeceasedCare = deceasedCare;
}
Expand All @@ -66,12 +69,14 @@ public record HospitalMovement
public int? Out { get; init; }
public int? Today { get; init; }
public int? ToDate { get; init; }
public HospitalMovement(int? inMovement, int? outMovement, int? current, int? today)
public int? ReasonCovid { get; init; }
public HospitalMovement(int? inMovement, int? outMovement, int? current, int? today, int? covid)
{
In = inMovement;
Out = outMovement;
Today = current;
ToDate = today;
ReasonCovid = covid;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ PatientsDay GetDailyPatientsFromRaw(ImmutableDictionary<string, int> header, str
GetHospitalMovement(facility: null, "niv", header, fields),
GetHospitalMovement(facility: null, "critical", header, fields),
GetStateDeceased(header, fields),
GetHospitalMovement(facility: null, "redzone", header, fields),
GetHospitalMovement(facility: null, "care", header, fields),
GetDeceasedCare(facility: null, header, fields),
new OutOfHospital(GetInt(fields[header["state.out_of_hospital.todate"]]))
Expand All @@ -524,6 +525,7 @@ PatientsDay GetDailyPatientsFromRaw(ImmutableDictionary<string, int> header, str
GetHospitalMovement(facility, "niv", header, fields),
GetHospitalMovement(facility, "critical", header, fields),
GetDeceased(facility, header, fields),
GetHospitalMovement(facility, "redzone", header, fields),
GetHospitalMovement(facility, "care", header, fields),
GetDeceasedCare(facility, header, fields)
);
Expand All @@ -539,11 +541,13 @@ HospitalMovement GetHospitalMovement(string facility, string type, ImmutableDict
string outKey = $"state{location}.{type}.out";
string currentKey = $"state{location}.{type}";
string toDateKey = $"state{location}.{type}.todate";
string covidKey = $"state{location}.{type}.covid";
return new HospitalMovement(
header.ContainsKey(inKey) ? GetInt(fields[header[inKey]]) : null,
header.ContainsKey(outKey) ? GetInt(fields[header[outKey]]): null,
header.ContainsKey(currentKey) ? GetInt(fields[header[currentKey]]): null,
header.ContainsKey(toDateKey) ? GetInt(fields[header[toDateKey]]): null
header.ContainsKey(toDateKey) ? GetInt(fields[header[toDateKey]]): null,
header.ContainsKey(covidKey) ? GetInt(fields[header[covidKey]]): null
);
}

Expand Down
2 changes: 1 addition & 1 deletion sources/SloCovidServer/SloCovidServer/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace SloCovidServer
{
public class Startup
{
const string SchemaVersion = "46";
const string SchemaVersion = "47";
const string CorsPolicy = "Any";
readonly IWebHostEnvironment env;
public Startup(IConfiguration configuration, IWebHostEnvironment env)
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.17</version>
<version>1.18</version>

0 comments on commit 6415d89

Please sign in to comment.