Newer
Older
web-services / mapping-tools / README.md
# mapping-tools

Ce service permet de remplacer des valeurs selon une table de correspondance.

Pour l'instant, il n'y a qu'une table, celle faisant correspondre des
identifiants RNSR à un ou plusieurs institut(s) du CNRS.

## Configuration

Il faut préciser dans le fichier de configuration de l'instance qu'elle utilise
les paquets node:

- `@ezs/basics`
- `@ezs/analytics`

Et jusqu'à `@ezs/analytics@1.16.4`, il faut ajouter `node-object-hash@2.3.10`.

Exemple:

```json
{
    "packages": [
        "@ezs/analytics@1.16.4",
        "@ezs/basics@1.14.0",
        "node-object-hash@2.3.10"
    ]
}
```

## Utilisation

- [v1/halAuthorId/idRef/json](#v1/halauthorid/idref/json)
- [v1/homogenize/documentType/json](#v1/homogenize/documenttype/json)
- [v1/homogenize/publisher/json](#v1/homogenize/publisher/json)
- [v1/homogenize/source/json](#v1/homogenize/source/json)
- [v1/idRef/orcid/json](#v1/idref/orcid/json)
- [v1/rnsr/instituts-cnrs/json](#v1/rnsr/instituts-cnrs/json)

### v1/halAuthorId/idRef/json

Renvoie l'idRef associé au halAuthorId fourni.

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec l'idRef associé au halAuthorId fourni.

#### Paramètres de v1/halAuthorId/idRef/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple de v1/halAuthorId/idRef/json

Avec le halAuthorId <https://data.archives-ouvertes.fr/author/1458607>.

```bash
curl -X POST "http://mapping-tools.tdmservices.intra.inist.fr/v1/halAuthorId/idRef/json" -H  "accept: application/json" -H  "Content-Type: application/json" -d "[{\"id\":0,\"value\":\"https://data.archives-ouvertes.fr/author/1458607\"}]"
```

Sortie:

```json
[
  {
    "id": 0,
    "value": "http://www.idref.fr/190260483/id"
  }
]
```

### v1/homogenize/documentType/json

Homogénéise le type de document d'une notice.

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec la forme canonique du type de document.

#### Paramètres de v1/homogenize/documentType/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple de v1/homogenize/documentType/json

Avec la valeur `"ART"`.

```bash
curl -X POST "http://mapping-tools.tdmservices.intra.inist.fr/v1/homogenize/documentType/json" -H  "accept: application/json" -H  "Content-Type: application/json" -d "[{\"id\":0,\"value\":\"ART\"}]"
```

Sortie:

```json
[
  {
    "id": 0,
    "value": "Article"
  }
]
```

### v1/homogenize/publisher/json

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec la forme canonique de l'éditeur envoyé dans le champ `value`.

#### Paramètres de v1/homogenize/publisher/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple de v1/homogenize/publisher/json

```bash
curl -X POST "https://mapping-tools.services.inist.fr/v1/homogenize/publisher/json" -H  "accept: application/json" -H  "Content-Type: application/json" -d "[{\"id\":0,\"value\":\"Springer Verlag\"}]"
```

Sortie:

```json
[
  {
    "id": 0,
    "value": "SPRINGER"
  }
]
```

### v1/homogenize/source/json

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec la forme canonique de la source envoyée dans le champ `value`.

#### Paramètres de v1/homogenize/source/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple de v1/homogenize/source/json

```bash
curl -X POST "https://mapping-tools.services.inist.fr/v1/homogenize/source/json" -H  "accept: application/json" -H  "Content-Type: application/json" -d "[{\"id\":0,\"value\":\"« Gilets jaunes » Hypothèses sur un mouvement\"}]"
```

Sortie:

```json
[
  {
    "id": 0,
    "value": "\"GILETS JAUNES\" : HYPOTHESES SUR UN MOUVEMENT"
  }
]
```

### v1/idRef/orcid/json

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec les ORCID correspondant à l'idRef envoyé dans le champ `value`.

#### Paramètres de v1/idRef/orcid/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple v1/idRef/orcird/json

```bash
curl -X POST "https://mapping-tools.services.inist.fr/v1/idRef/orcid/json" -H  "accept: application/json" -H  "Content-Type: application/json" -d "[{\"id\":0,\"value\":\"http://www.idref.fr/190260483/id\"}]"
```

Sortie:

```json
[{
    "id": 0,
    "value": "https://orcid.org/0000-0003-1301-3305"
}]
```

### v1/rnsr/instituts-cnrs/json

Prend en entrée du JSON avec deux champs: `id` et `value`, et renvoie un JSON
avec un institut du CNRS dans le champ `value`.

> **Remarque**: quand on ne trouve pas d'institut, la valeur est `n/a` (*not
> available*)

#### Paramètres de v1/rnsr/instituts-cnrs/json

| nom    | description                                                            |
| :----- | :--------------------------------------------------------------------- |
| indent | `true` ou `false`, indente le JSON résultat ou non (`true` par défaut) |

#### Exemple

```bash
$ cat <<EOF | curl -X POST --data-binary @- "https://mapping-tools.services.inist.fr/v1/rnsr/instituts-cnrs/json?indent=true"
[{ "id": 1, "value": "200919362L" }, { "id": 2, "value": "200112440X"}]
EOF
```

Sortie

```json
[{
    "id": 1,
    "value": "INEE"
},
{
    "id": 2,
    "value": "STIC"
}]
```