I previously shared this query, but unfortunately, I didn't receive many helpful responses
I have a JSON file that holds the following dataset:
[{
"ID": 1030980,
"Component": "Glikoza (Gluk)",
"Result": "16",
"Date": "20.10.2018"
},
{
"ID": 1030980,
"Component": "Kreatinin (Creat)",
"Result": "5",
"Date": "19.10.2018"
},
{
"ID": 1030989,
"Component": "Urea (UN)",
"Result": "1",
"Date": "19.10.2018"
},
...and so forth
]
UPDATE: I've integrated this code into my patients.component:
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-patients',
templateUrl: './patients.component.html',
styleUrls: ['./patients.component.css']
})
export class PatientsComponent implements OnInit {
title = 'Patient Data';
constructor(private http: HttpClient) { }
ngOnInit(): void {
this.http
.get('./assets/patients.json')
.subscribe(res => {
const patients = res['patients'];
const patient = patients[0];
for (let i = 0; i < patients.length; i++) {
let item = patients[i];
console.log(item['ID'], item['date'], item['component'], item['result']);
}
});
}
}
Now, I aim to extract the 'component' and 'result' based on Patient ID and Date in a tabular format (displaying the results of each component for various dates and IDs). The table should showcase ALL COMPONENTS AND RESULTS for the specific ID and Date, resembling this layout:
If you could provide me with some guidance on how to achieve this task, I would greatly appreciate it! Thank you!