README.md 4.33 KB
Newer Older
1
# Data Catalogue
Emmanuel Raviart's avatar
Emmanuel Raviart committed
2
3
4
5
6
7

_Fetch, validate, convert & serve CESSDA-compliants DDI repositories._

## Installation

```bash
8
9
git clone https://git.nomics.world/progedo/data-catalogue.git
cd data-catalogue/
Emmanuel Raviart's avatar
Emmanuel Raviart committed
10
npm install
11
ln -s example.env .env
Emmanuel Raviart's avatar
Emmanuel Raviart committed
12
13
```

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
### Database Creation

#### Using _Debian GNU/Linux_

As `root` user:

```bash
apt install postgresql
su - postgres
psql
```

#### Using _MacOS_

```bash
brew install postgresql
psql postgres
```

#### For everybody

```sql
36
37
38
CREATE USER data_catalogue WITH PASSWORD 'data_catalogue';
CREATE DATABASE data_catalogue WITH OWNER data_catalogue;
\connect data_catalogue
39
40
41
42
43
44
45
46
47
48
49
CREATE EXTENSION IF NOT EXISTS pg_trgm;
\q
logout # For Debian only
```

As normal user, create database tables:

```bash
npm run configure
```

Emmanuel Raviart's avatar
Emmanuel Raviart committed
50
51
## Usage

Emmanuel Raviart's avatar
Emmanuel Raviart committed
52
53
### Fetching Nesstar Servers

Emmanuel Raviart's avatar
Emmanuel Raviart committed
54
```bash
55
# ADISP
56
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://nesstar.progedo-adisp.fr/ ../public_data/adisp-ddi/
57
58
# CDSP Sciences Po (obsolete & closed)
# npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://nesstar.sciences-po.fr/ ../public_data/cdsp-ddi/
59
# INED
60
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://nesstar.ined.fr/ ../public_data/ined-ddi/
61
# INED - Generations and Gender Survey
62
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://ggpsurvey.ined.fr/ ../public_data/ined-gpgsurvey-ddi/
63
# UK Data Service
64
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://nesstar.ukdataservice.ac.uk/ ../public_data/ukdataservice-ddi/
65
# Norwegian Centre for Research Data
66
67
68
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.ts --url http://nsddata.nsd.uib.no ../public_data/nsddata-ddi/
```

69
70
71
72
73
74
75
### Fetching Dataverse Servers

```bash
# data.sciencespo
npx babel-node --extensions ".ts" -- src/scripts/retrieve_dataverse_ddis.ts --url https://data.sciencespo.fr/ --verbose ../public_data/sciences-po/
```

76
77
78
79
80
### Repairing DDI files

```bash
# ADISP
npx babel-node --extensions ".ts" src/scripts/repair_adisp_ddis.ts --source=../public_data/adisp-ddi/  ../public_data/adisp-ddi-repaired
Emmanuel Raviart's avatar
Emmanuel Raviart committed
81
```
Emmanuel Raviart's avatar
Emmanuel Raviart committed
82

83
84
85
### Indexing DDI files

```bash
86
87
88
89
90
91
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=fr --path=adisp ../public_data/adisp-ddi-repaired/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=fr --path=cdsp ../public_data/cdsp-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=fr --path=ined ../public_data/ined-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=fr --path=ined/gpgsurvey ../public_data/ined-gpgsurvey-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=en --path=ukdataservice ../public_data/ukdataservice-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --language=no --path=nsddata ../public_data/nsddata-ddi/
92
93
```

94
95
96
97
98
99
### Extracting words from CodeBooks from autocompletion

```bash
npx babel-node --extensions ".ts" -- src/scripts/index_words.ts
```

100
101
## Development

Emmanuel Raviart's avatar
Emmanuel Raviart committed
102
103
### Extracting TypeScript Raw Types from DDI files

104
105
In `data-catalogue` directory:

Emmanuel Raviart's avatar
Emmanuel Raviart committed
106
```bash
107
108
109
110
npx babel-node --extensions ".ts" --max-old-space-size=10240 src/scripts/raw_types_from_ddi_files.ts ../public_data/adisp-ddi/ ../public_data/cdsp-ddi/ ../public_data/ined-ddi/
npx babel-node --extensions ".ts" --max-old-space-size=10240 -- src/scripts/raw_types_from_ddi_files.ts ../public_data/adisp-ddi/ ../public_data/cdsp-ddi/ ../public_data/ined-ddi/ --version=1.2.2
npx babel-node --extensions ".ts" -- src/scripts/raw_types_from_ddi_files.ts ../public_data/adisp-ddi/ ../public_data/cdsp-ddi/ ../public_data/ined-ddi/ --version=1.3

Emmanuel Raviart's avatar
Emmanuel Raviart committed
111
112
npx babel-node --extensions ".ts" --max-old-space-size=8192 src/scripts/raw_types_from_ddi_files.ts ../public_data/xml-ddi-adisp/ --target=src/raw_types/enquetes_adisp_fournies.ts
npx babel-node --extensions ".ts" --max-old-space-size=8192 src/scripts/raw_types_from_ddi_files.ts ../public_data/adisp-ddi/ --target=src/raw_types/enquetes_adisp.ts
113
114
npx babel-node --extensions ".ts" src/scripts/raw_types_from_ddi_files.ts ../public_data/cdsp-ddi/ --target=src/raw_types/enquetes_cdsp.ts
npx babel-node --extensions ".ts" src/scripts/raw_types_from_ddi_files.ts ../public_data/ined-ddi/ --target=src/raw_types/enquetes_ined.ts
Emmanuel Raviart's avatar
Emmanuel Raviart committed
115
116
117
118

# Prettify generated TypeScript files:
npm run prettier
```