Forum Discussion
_anomDiebolt_
7 years agoQrew Elite
I think key issue is that the block of CSV that you import has data the should properly be part of the both the Patients and Prescriptions tables. For example let's say the CSV data looked like this:
The way to accomplish this it to write a short script that reads the CSV data, groups it by [PatietID] and make two calls to API_ImportFromCSV - one to the Patients table and a second one to the Prescriptions table.
Any other procedure that does not first group the data by Patient before importing will not get around the problem you are experiencing.
[PatientID], [PatientName], [Drug], [Quantity], [Date], [Notes]Instead of importing everything into one table, the first two fields [Patient ID] and [PatientName] should be imported into the Patients table while [Drug], [Quantity], [Date], [Notes] fields should be imported into Prescriptions table and also be related to the corresponding Patients record.
ID101, Jane, Hydrocodone, 30, 1/1/2019, lorem ipsum
ID101, Jane, Levothyroxine, 10, 1/1/2019, dolor sit
ID101, Jane, Prednisone, 20, 1/1/2019, amet consectetur
ID201, John, Amoxicillin, 60, 1/2/2019, adipiscing elit
ID201, John, Gabapentin, 60, 1/3/2019, Aliquam gravida
ID201, John, Lisinopril, 10, 1/4/2019, sollic tincidunt
ID301, Mary, Atorvastatin, 20, 1/6/2019, Nam enim
ID301, Mary, Metformin, 40, 1/7/2019, mi mattis
ID301, Mary, Ondansetron, 10, 1/7/2019, vel molestie
ID301, Mary, Ibuprofen, 10, 1/9/2019, id porta
The way to accomplish this it to write a short script that reads the CSV data, groups it by [PatietID] and make two calls to API_ImportFromCSV - one to the Patients table and a second one to the Prescriptions table.
Any other procedure that does not first group the data by Patient before importing will not get around the problem you are experiencing.