You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-88Lines changed: 1 addition & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ uv run main.py --help
19
19
#### 01 Get data from NVA
20
20
21
21
```bash
22
-
uv run main.py --help
22
+
uv run nva.py --help
23
23
```
24
24
25
25
You have to add flags to specify what type of data you want to fetch:
@@ -29,90 +29,3 @@ You have to add flags to specify what type of data you want to fetch:
29
29
-`--persons` fetches people
30
30
-`--categories` fetches categories
31
31
-`--funding_sources` fetches funding sources.
32
-
33
-
Question: Why am I only getting 1438 rows in my DLT-table?
34
-
35
-
#### 02 Get data from Pbase (internal database)
36
-
37
-
1. Set up sling correctly (connect and authenticate to Pbase).
38
-
2. Run the script underneath
39
-
40
-
```bash
41
-
sling run -r repliacte_pbase_cristin.yaml
42
-
```
43
-
44
-
#### 03 Synchronize the data from NVA to Pbase
45
-
46
-
The project includes a data synchronization script (`sync_data.py`) that merges publications from the NVA database (`nva_sync.duckdb`) into the existing Cristin database (`pbase_duck/pbase.duckdb`).
47
-
48
-
1.**Detect duplicates**: The script compares publications by title and publication year to avoid duplicates
49
-
2.**Data Mapping**: NVA API fields are mapped to Cristin database schema using the mapping table above
50
-
3.**Incremental IDs**: New publications receive auto-generated PubID values starting from the highest existing ID + 1
51
-
52
-
```bash
53
-
uv run src.datasync.sync_nva_cristin.py
54
-
```
55
-
56
-
The script will:
57
-
58
-
- Analyze both databases to find new publications in NVA that don't exist in the table Cristin in database Pbase
59
-
- Map NVA data to match Cristin schema
60
-
- Insert new records with the field mapping
61
-
- Report the number of publications added
62
-
63
-
## Data mappings
64
-
65
-
The following table shows how data fields are mapped from the NVA API to the Cristin database format.
|`Tidsskrift`|`entityDescription.reference.publicationContext.journal`|`entity_description__reference__publication_context__name` Is this column supposed to be the same as `Utgiver`? |
|`Authors`|`entityDescription.contributors` (must be mapped) | Ligger i tabell `resources__entity_description__contributors` under kolonne `identity__name`|
|`sprak`|`entityDescription.language` (mapp to language codes) |`entity_description__language`|
102
-
103
-
-* If table not specified it's in `resources` table.
104
-
-** If column is `None` NVA doesn't have the data
105
-
106
-
### Language Code Mapping
107
-
108
-
The language field uses the following mapping from NVA API language URIs to match the ones already existing in the Cristin table:
109
-
110
-
-`http://lexvo.org/id/iso639-3/eng` → `EN`
111
-
-`http://lexvo.org/id/iso639-3/nor` → `NO`
112
-
-`http://lexvo.org/id/iso639-3/nob` → `NOB`
113
-
114
-
There are a few others which must be mapped.
115
-
116
-
### Authors mapping
117
-
118
-
The API returns a list of contributors with various properties. We want to map this correctly to the current structure of the database. An example from `Pbase` is: `Aas, Ø., Einum, S., Klemetsen, A.& Skurdal, J.`. The structure is, with an example of three authors: `<lastname>, <letter_of_firstname>., <lastname>, <letter_of_firstname>. & <lastname>, <letter_of_firstname>.`
0 commit comments