README.md 3.79 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
55
```bash
npx tsc
56
# ADISP
57
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://nesstar.progedo-adisp.fr/ ../public_data/adisp-ddi/
58
# CDSP Sciences Po
59
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://nesstar.sciences-po.fr/ ../public_data/cdsp-ddi/
60
# INED
61
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://nesstar.ined.fr/ ../public_data/ined-ddi/
62
# INED - Generations and Gender Survey
63
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://ggpsurvey.ined.fr/ ../public_data/ined-gpgsurvey-ddi/
64
# UK Data Service
65
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://nesstar.ukdataservice.ac.uk/ ../public_data/ukdataservice-ddi/
66
# Norwegian Centre for Research Data
67
npx babel-node --extensions ".ts" src/scripts/retrieve_nesstar_ddis.js --url http://nsddata.nsd.uib.no ../public_data/nsddata-ddi/
Emmanuel Raviart's avatar
Emmanuel Raviart committed
68
```
Emmanuel Raviart's avatar
Emmanuel Raviart committed
69

70
71
72
73
74
75
76
77
78
79
80
81
82
### Indexing DDI files

```bash
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=adisp --title=\"Archives de données issues de la statistique publique \(ADISP\)\" ../public_data/adisp-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=cdsp --title=\"SciencesPo Centre de données socio-politiques \(CDSP\)\" ../public_data/cdsp-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=ined --title=\"Institut national d\'études démographiques \(INED\)\" ../public_data/ined-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=ined/gpgsurvey --title=\"Enquête Générations et Genre du projet international Generations and Gender Programme \(GGP\)\" ../public_data/ined-gpgsurvey-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=ukdataservice --title=\"UK Data Service\" ../public_data/ukdataservice-ddi/
npx babel-node --extensions ".ts" -- src/scripts/index_code_books.ts --path=nsddata --title=\"Norwegian Centre for Research Data \(NSD\)\" ../public_data/nsddata-ddi/
```

## Development

Emmanuel Raviart's avatar
Emmanuel Raviart committed
83
84
### Extracting TypeScript Raw Types from DDI files

85
86
In `data-catalogue` directory:

Emmanuel Raviart's avatar
Emmanuel Raviart committed
87
```bash
88
npx babel-node --extensions ".ts" --max-old-space-size=10240 src/scripts/raw_types_from_ddi_files.ts ../public_data/adisp-ddi/ ../public_data/adisp-ddi/ ../public_data/ined-ddi/ --target=src/raw_types/code_books.ts
Emmanuel Raviart's avatar
Emmanuel Raviart committed
89
90
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
91
92
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
93
94
95
96

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