Skip to content

Commit

Permalink
Merge pull request #18 from Cambio-Project/misim_integration
Browse files Browse the repository at this point in the history
Misim integration
  • Loading branch information
a-baur authored Mar 19, 2024
2 parents 7e5b69e + 3ecd04a commit dbe55fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/app/core/services/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export class DataService {
});
}

parseCsvFileFromAssets(fileName: string) {
parseCsvFileFromAddress(address: string, filename: string) {
return new Promise<Dataset>((resolve, reject) => {
this.http.get(`assets/csv/${fileName}`, {responseType: 'arraybuffer'})
this.http.get(`${address}/${filename}`, {responseType: 'arraybuffer'})
.subscribe(async data => {
const file = this.blobToFile(data, fileName);
const file = this.blobToFile(data, filename);
try {
const dataset = await this.parseCsvFile(file);
resolve(dataset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@ export class PropertyEditComponent implements OnInit, AfterViewInit {
async skipToSpecification() {
try {
this.route.queryParams.subscribe(async params => {
this.dataset = await this.dataSvc.parseCsvFileFromAssets(params["file"]) //TODO Change with request content
let address = params["file-address"] || "assets/csv"
let filename = params["file"]
let sim_id = params["sim_id"]

if (!!filename == !!sim_id) {
throw new Error("Either provide sim_id or file name, not both or none.")
}
if (sim_id) {
address = `${address}/${sim_id}`
filename = "_combined.csv"
}
this.dataset = await this.dataSvc.parseCsvFileFromAddress(address, filename)

if (params["pattern"] === "Absence"){
this.property = this.getAbsencePSP()

}
})
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class CsvLoaderComponent implements OnInit {
}

async loadCsvFileFromAssets(fileName: string) {
const dataset = await this.dataSvc.parseCsvFileFromAssets(fileName);
const dataset = await this.dataSvc.parseCsvFileFromAddress('assets/csv', fileName);
this.setDataset(dataset);
}

Expand Down

0 comments on commit dbe55fc

Please sign in to comment.