Skip to content

Commit

Permalink
Merge branch 'development' into 6841-create-paragraph-extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-huridocs authored Oct 11, 2024
2 parents e2e9768 + 93bad26 commit 48a2c92
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/api/csv/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const csv = (readStream: Readable, stopOnError = false) => ({

async read() {
this.reading = true;
return csvtojson({ delimiter: DELIMITERS })
return csvtojson({ delimiter: DELIMITERS, flatKeys: true })
.fromStream(readStream)
.subscribe(async (row: CSVRow, index) => {
if (!this.reading) {
Expand Down
8 changes: 4 additions & 4 deletions app/api/csv/specs/__snapshots__/importFile.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`importFile readStream should return a readable stream for the csv file 1`] = `
"Title , text label , numeric label, non configured, select_label, not defined type, geolocation_geolocation,auto id, additional tag(s), Multi Select Label, Date label, Language
"Title , header.with.dots, text label , numeric label, non configured, select_label, not defined type, geolocation_geolocation,auto id, additional tag(s), Multi Select Label, Date label, Language
title1, text value 1, 1977, ______________, thesauri1 , notType1 , 1|1,,tag1, multivalue1,03/01/2022,English
title2, text value 2, 2019, ______________, thesauri2 , notType2 , ,,tag2, multivalue2,01/03/2022,Spanish
title3, text value 3, 2020, ______________, thesauri2 , notType3 , 0|0,,tag3, multivalue1|multivalue3,01/01/2022,AnyStringIsGood
title1, header with dots value 1, text value 1, 1977, ______________, thesauri1 , notType1 , 1|1,,tag1, multivalue1,03/01/2022,English
title2, header with dots value 2, text value 2, 2019, ______________, thesauri2 , notType2 , ,,tag2, multivalue2,01/03/2022,Spanish
title3, header with dots value 3, text value 3, 2020, ______________, thesauri2 , notType3 , 0|0,,tag3, multivalue1|multivalue3,01/01/2022,AnyStringIsGood
"
`;

Expand Down
1 change: 1 addition & 0 deletions app/api/csv/specs/csvLoader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ describe('csvLoader', () => {
numeric_label: [{ value: 1977 }],
select_label: [{ label: 'thesauri1', value: expect.any(String) }],
text_label: [{ value: 'text value 1' }],
header_with_dots: [{ value: 'header with dots value 1' }],
});
});

Expand Down
5 changes: 5 additions & 0 deletions app/api/csv/specs/csvLoaderFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export default {
label: 'text label',
name: templateUtils.safeName('text label'),
},
{
type: propertyTypes.text,
label: 'header.with. dots',
name: templateUtils.safeName('header.with.dots'),
},
{
type: propertyTypes.numeric,
label: 'numeric label',
Expand Down
8 changes: 4 additions & 4 deletions app/api/csv/specs/test.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Title , text label , numeric label, non configured, select_label, not defined type, geolocation_geolocation,auto id, additional tag(s), Multi Select Label, Date label, Language
Title , header.with.dots, text label , numeric label, non configured, select_label, not defined type, geolocation_geolocation,auto id, additional tag(s), Multi Select Label, Date label, Language

title1, text value 1, 1977, ______________, thesauri1 , notType1 , 1|1,,tag1, multivalue1,03/01/2022,English
title2, text value 2, 2019, ______________, thesauri2 , notType2 , ,,tag2, multivalue2,01/03/2022,Spanish
title3, text value 3, 2020, ______________, thesauri2 , notType3 , 0|0,,tag3, multivalue1|multivalue3,01/01/2022,AnyStringIsGood
title1, header with dots value 1, text value 1, 1977, ______________, thesauri1 , notType1 , 1|1,,tag1, multivalue1,03/01/2022,English
title2, header with dots value 2, text value 2, 2019, ______________, thesauri2 , notType2 , ,,tag2, multivalue2,01/03/2022,Spanish
title3, header with dots value 3, text value 3, 2020, ______________, thesauri2 , notType3 , 0|0,,tag3, multivalue1|multivalue3,01/01/2022,AnyStringIsGood
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uwazi",
"version": "1.188.0-rc9",
"version": "1.188.0-rc10",
"description": "Uwazi is a free, open-source solution for organising, analysing and publishing your documents.",
"keywords": [
"react"
Expand Down Expand Up @@ -43,7 +43,7 @@
"hot-e2e": "DATABASE_NAME=uwazi_e2e INDEX_NAME=uwazi_e2e EXTERNAL_SERVICES=true yarn hot",
"run-e2e": "DATABASE_NAME=uwazi_e2e INDEX_NAME=uwazi_e2e EXTERNAL_SERVICES=true yarn run-production",
"hot-inspect": "export HOT=true; export BABEL_ENV=debug; yarn run watch-types & yarn dev-server --inspect & yarn run webpack-server",
"hot-debug": "export HOT=true; export BABEL_ENV=debug; node --no-experimental-fetch --inspect-brk=9229 server.js",
"hot-debug": "export HOT=true; export BABEL_ENV=debug; node --no-experimental-fetch --inspect-brk=9229 server.js & yarn run webpack-server",
"reindex": "node scripts/run.js ../database/reindex_elastic.js",
"import-csv": "node --no-experimental-fetch scripts/run.js ../database/import_csv.js",
"blank-state": "node --no-experimental-fetch scripts/bash.js ./database/blank_state.sh",
Expand Down

0 comments on commit 48a2c92

Please sign in to comment.