We are building an analytic engine for our clients. We have choose Cosmos DB. The reason for this is to store unstructured data. For the moment for one client we have around 300000 records.
Sample analytic item
{
"adjustments": [],
"payments": [],
"amountReceivable": 0,
"amountReceivablePatient": 0,
"amountReceivableInsurance": 0,
"id": "1_10",
"clientID": 1,
"chargeID": "10",
"encounterID": "29310660",
"patientID": "232362",
"provider": "eeee",
"financialClass": "kkk",
"insurancePrimary": "jjj",
"dateOfServiceBegin": "2019-08-19T18:30:00Z",
"location": "test location","chargeTotal": 272,
"chargeInsurancePrimary": 272,
"chargePatient": 0
}
To show cumulative details in the dashboards we have created another collection called summary. This will hold the monthly and yearly pre calculated data. This is the collection we are going to use for our client application.
sample summary collection item
{
"id": "630b20678a4745c4881b4d5cf07bcf08",
"clientId": 1,
"location": "test location",
"provider": "eee",
"periodicity": "monthly",
"date": "2019-10-01T00:00:00",
"financialClass": "kkk",
"carrier": "jjj",
"totalChargeByDoE": 488,
"totalChargeInsuranceByDoE": 488,
"totalChargePatientByDoE": 0,
"totalChargeByDoS": 488,
"totalChargeInsuranceByDoS": 488,
"totalChargePatientByDoS": 0,
"totalAdjustmentByDoE": 407,
"totalAdjustmentInsuranceByDoE": 407,
}
The problem we are facing for the moment is calculating the cumulative records for the first time.Currently we are getting all the data from analytic collection and populating a list from that. Then calculating the monthly and yearly wise and then inserting to summary container. This is very slow and consuming more RUs. This issue is only for the existing data. We have implemented the change feed processor to handle real time data. Is there any way to reduce this process time and RUs? Thanks in advance.