Skip to content

Commit 321bc2a

Browse files
committed
remove cristin stuff
1 parent da281ee commit 321bc2a

3 files changed

Lines changed: 1 addition & 474 deletions

File tree

README.md

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ uv run main.py --help
1919
#### 01 Get data from NVA
2020

2121
```bash
22-
uv run main.py --help
22+
uv run nva.py --help
2323
```
2424

2525
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:
2929
- `--persons` fetches people
3030
- `--categories` fetches categories
3131
- `--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.
66-
67-
| Cristin-table | NVA API Source | NVA DLT table |
68-
|------------------|----------------|----------------|
69-
| `PubID` | `None` (auto-generated) | `None` (auto-generated) |
70-
| `Tittel` | `entityDescription.mainTitle` |`entity_description__main_title` |
71-
| `Publiseringsaar` | `entityDescription.publicationDate.year` | `entity_description__publication_date__year` |
72-
| `DatoRegistrert` | `createdDate` | `created_date` |
73-
| `DatoEndret` | `modifiedDate` | `modified_date` |
74-
| `Kategori` | `entityDescription.reference.publicationContext.type` | `entity_description__reference__publication_context__type` |
75-
| `URL` | `id` | `id` have to add the rest of the link: https://nva.sikt.no/registration |
76-
| `KategoriNavn` | `None` | `None` |
77-
| `Underkategori` | `entityDescription.reference.publicationInstance.type` |`entity_description__reference__publication_instance__type` |
78-
| `Rapportserie` | `entityDescription.reference.publicationContext.seriesNumber` | `entity_description__reference__publication_context__series_number` |
79-
| `Tidsskrift` | `entityDescription.reference.publicationContext.journal` | `entity_description__reference__publication_context__name` Is this column supposed to be the same as `Utgiver`? |
80-
| `TidsskriftNiva` | `None` | `None` |
81-
| `hefte` | `None` | `None` |
82-
| `volum` | `None` | `None` |
83-
| `sider` | `entityDescription.reference.publicationInstance.pages.(end/begin)` | `entity_description__reference__publication_instance__pages__(begin/end)` |
84-
| `issn` | `entityDescription.reference.publicationContext.series.onlineIssn` | `entity_description__reference__publication_context__series__online_issn` |
85-
| `ForedragArr` | `None` | `None` |
86-
| `Foredragsdato` | `None` | `None` |
87-
| `Authors` | `entityDescription.contributors` (must be mapped) | Ligger i tabell `resources__entity_description__contributors` under kolonne `identity__name` |
88-
| `Skjul` | `None` | `None` |
89-
| `Featured` | `None` | `None` |
90-
| `Timestamp` | `None` | `None` |
91-
| `Tekst` | `entityDescription.abstract` | `entity_description__abstract` |
92-
| `Eier` | `resourceOwner.owner` (must be mapped, not sure how yet) | resource_owner__owner |
93-
| `DateLastModified` | `modifiedDate` | modified_date |
94-
| `isbn` | `entityDescription.reference.publicationContext.isbnList[0]` | `???` Not sure where to find this in DLT? |
95-
| `Forlag` | `None` | `None` |
96-
| `BokNiva` | `None` | `None` |
97-
| `Referanse` | `None` | `None` |
98-
| `doi` | `entityDescription.reference.doi` | `entity_description__reference__doi` |
99-
| `TilPubliste` | `None` | `None` |
100-
| `Utgiver` | `entityDescription.reference.publisher.name` | `entity_description__reference__publication_context__name` |
101-
| `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>.`

repliacte_pbase_cristin.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)