Skip to content

Data Sync Scripts

datasync

Provide subcommands for synchronizing different resources, see subcommands

Usage

datasync [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

Name Description Required Default
--install-completion Install completion for the current shell. No -
--show-completion Show completion for the current shell, to copy it or customize the installation. No -

Commands

Name Description
nva Commands to handle NVA tasks
ubw Export UBW APIs to Parquet in S3 bucket
dms
ninagen Commands to handle NINAGEN tasks
pit-registering-salmon
grass-gis
services Miljødata Infrastructure as Code pipelines
gbif-backbone export GBIF Backbone data to DuckDB database
ipt Provide commands to deal with IPT

Subcommands

nva

Commands to handle NVA tasks

Usage

datasync nva [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

run

Sync NVA data from REST API to target

Usage

datasync nva run [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--resources / --no-resources No no-resources
--projects / --no-projects No no-projects
--persons / --no-persons No no-persons
--categories / --no-categories No no-categories
--funding-sources / --no-funding-sources No no-funding-sources
--base-url Base URL for the NVA API No https://api.nva.unit.no/
--duckdb-name No nva_sync
--institution-code NVA institution code No 7511.0.0.0
--endpoint-url AWS S3 endpoint URL Yes -
--access-key AWS S3 access key Yes -
--secret-key AWS S3 secret key Yes -
--bucket AWS S3 bucket name Yes -
--prefix AWS S3 prefix (folder path) for storing data Yes -
--region AWS S3 region No us-east-1
filter-data

Filter NVA parquet files and export to S3

Usage

datasync nva filter-data [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--resource-name Name for the filtered resource Yes -
--data-s3-path S3 path for input data Yes -
--storage-s3-endpoint S3 endpoint URL for storage Yes -
--storage-access-key S3 access key for storage Yes -
--storage-secret-key S3 secret key for storage Yes -
--storage-bucket S3 bucket for storage Yes -
--storage-prefix S3 prefix for storage Yes -
--filter Filter by column value (format: column=value). Can specify multiple filters. No -
--show-columns Display available column names and exit No False
search-resources-api

Fetch and filter NVA data with flexible search parameters

Usage

datasync nva search-resources-api [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--resource-name Name for the DLT resource Yes -
--base-url Base URL for the NVA API No https://api.nva.unit.no/
--filter, -f Filter parameters as key=value pairs. Valid keys: {'published_since', 'scientific_report_period_before', 'institution_not', 'contributor', 'publication_year_before', 'project_not', 'top_level_organization', 'publisher_id', 'orcid_not', 'issn_should', 'grant_id_should', 'publication_language_not', 'id_should', 'id_not', 'context_type_not', 'institution', 'user', 'isbn_should', 'tags', 'publication_year_since', 'status_should', 'publisher_not', 'category', 'funding_identifier_should', 'category_should', 'contributor_name_should', 'page', 'created_before', 'parent_publication', 'from', 'cristin_identifier', 'tags_should', 'parent_publication_should', 'size', 'license_should', 'unit', 'doi_not', 'instance_type_should', 'instance_type_not', 'parent_type', 'doi', 'exclude_parent_type', 'publisher_id_not', 'user_not', 'series_should', 'isbn_not', 'course', 'doi_should', 'query', 'modified_since', 'scientific_report_period_since', 'order', 'has_file', 'grant_id_not', 'isbn', 'orcid', 'publisher_should', 'tags_not', 'license_not', 'unit_not', 'unit_should', 'modified_before', 'contributor_name', 'title_should', 'abstract', 'fields', 'aggregation', 'license', 'funding', 'contributor_name_not', 'orcid_should', 'funding_source', 'context_type', 'scopus_identifier', 'issn', 'Accept', 'issn_not', 'funding_source_should', 'series_not', 'abstract_not', 'publisher_id_should', 'user_affiliation_not', 'scientific_value', 'published_between', 'context_type_should', 'instance_type', 'published_before', 'institution_should', 'user_affiliation_should', 'funding_identifier', 'category_not', 'course_not', 'grant_id', 'user_should', 'status_not', 'status', 'funding_source_not', 'publication_language_should', 'parent_publication_year', 'publication_language', 'title_not', 'sort', 'project_should', 'project', 'has_isbn', 'has_issn', 'publisher', 'title', 'course_should', 'exclude_parent_publication_year', 'publication_year', 'contributor_not', 'lang', 'abstract_should', 'contributor_should', 'series', 'user_affiliation', 'funding_identifier_not', 'exclude_subunits', 'id', 'created_since'} No []
--apply-filter / --no-apply-filter Apply extract_useful_info.sql transformation No apply-filter
--storage-endpoint-url S3 endpoint URL for storage Yes -
--storage-access-key S3 access key for storage Yes -
--storage-secret-key S3 secret key for storage Yes -
--storage-bucket S3 bucket for storage Yes -
--storage-prefix S3 prefix for storage Yes -
--storage-region S3 region for storage No us-east-1
--add-timestamp / --no-add-timestamp Whether to write last successful run timestamp to S3 No add-timestamp
get-pubs-per-researcher

Fetch publications for researchers at NINA

Usage

datasync nva get-pubs-per-researcher [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--employees-parquet Path to employees parquet file Yes -
--storage-s3-path S3 endpoint URL for storage Yes -
--storage-access-key S3 access key for storage Yes -
--storage-secret-key S3 secret key for storage Yes -
--storage-bucket S3 bucket for storage Yes -
--storage-prefix S3 prefix for storage Yes -
--storage-region S3 region for storage No us-east-1
--test / --no-test If set, will only fetch publications for the first 3 researchers No no-test

ubw

Export UBW APIs to Parquet in S3 bucket

Usage

datasync ubw [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

run

No description available

Usage

datasync ubw run [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--access-key No -
--secret-key No -
--endpoint-url No -
--bucket No -
--prefix No -
--base-url No -
--auth No -

dms

No description available

Usage

datasync dms [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

generate-csw-metadata

No description available

Usage

datasync dms generate-csw-metadata [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--base-url No -
--access-key No -
--secret-key No -
--endpoint No -
--bucket No -
--publish-url No -
--limit No -
--search Filter resources by title using a LIKE expression No -
generate-geoapi-config

No description available

Usage

datasync dms generate-geoapi-config [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--base-url No -
--publish-url No -
--search Filter resources by title using a LIKE expression No -
generate-maps-json

Generate a maps.json file from map resources in the DMS parquet files. The output follows the format used by the NINA map-editor. The URL for each map is read from the uri field of the resource. The file is written to S3 as a publicly accessible file.

Usage

datasync dms generate-maps-json [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--base-url No -
--access-key No -
--secret-key No -
--endpoint No -
--where Provide an additional SQL filter No 1=1
--bucket S3 bucket for output (e.g., 'my-bucket') No -
--output S3 key path for output JSON file No /dms/maps/maps.json

ninagen

Commands to handle NINAGEN tasks

Usage

datasync ninagen [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

snp-database-normalize

Convert SNP excel sheet to parquet

Usage

datasync ninagen snp-database-normalize [OPTIONS] FILE [SHEET]

Arguments
Name Description Required
FILE path to the file Yes
SHEET Name of the Excel Sheet to use No
Options
Name Description Required Default
--header-row XLSX Row number that contains the header No 1
--allele-start-column XLSX column that contains the first allele No F
snp-analysis-to-parquet

Convert SNP csv of an analysis to a parquet file

Usage

datasync ninagen snp-analysis-to-parquet [OPTIONS] FILE

Arguments
Name Description Required
FILE Path to the csv file Yes
Options

No options available

pit-registering-salmon

No description available

Usage

datasync pit-registering-salmon [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

run

Download PIT data from BioMark's API to a .duckdb file.

Usage

datasync pit-registering-salmon run [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--duckdb-path No biomark_pit_registering_salmon_v1.duckdb
--place Site location (kongsfjord, sylte, vigda, agdenes, vatne) No -
--begin-date Start date for data download in YYYY-MM-DD format No -
--end-date End date for data download in YYYY-MM-DD format No -
--tags / --no-tags Download tags data No no-tags
--readers / --no-readers Download readers voltage data No no-readers
--environment / --no-environment Download environment data No no-environment
--all-locations / --no-all-locations Download data from all accessible locations No no-all-locations
--base-url No https://data3.biomark.com/api/v1/
--yesterday / --no-yesterday Set date range to yesterday only No no-yesterday
--dataset-name No main

grass-gis

No description available

Usage

datasync grass-gis [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

register-layers

No description available

Usage

datasync grass-gis register-layers [OPTIONS] PARQUET_FILE_PATH

Arguments
Name Description Required
PARQUET_FILE_PATH Yes
PROJECT_NUMBER Yes
GISBASE Yes
Options

No options available

services

Miljødata Infrastructure as Code pipelines

Usage

datasync services [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

services-to-parquet

Convert metadata.yml definitions to a set of parquet that can be imported in the DMS

Usage

datasync services services-to-parquet [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--org No ninanor
--repo No -
--bucket No -
--endpoint No -
--access-key No -
--secret-key No -
--prefix No /dms/tables
--git-username No -
--git-token No -
dashboard

Produce a Homer Dashbord using the Miljødata Infrastructure as Code repository as data source

Usage

datasync services dashboard [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--org No ninanor
--repo No -
--config-org No ninanor
--config-repo No -
--bucket No -
--endpoint No -
--access-key No -
--secret-key No -
--git-username No -
--git-token No -
--prefix No /dms/services
dashboard-test

Test the parsing of the services metadata and the generation of the dashboard configuration

Usage

datasync services dashboard-test [OPTIONS]

Arguments

No arguments available

Options

No options available

gbif-backbone

export GBIF Backbone data to DuckDB database

Usage

datasync gbif-backbone [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

import-all

Import GBIF Backbone data into a DuckDB database.

Usage

datasync gbif-backbone import-all [OPTIONS]

Arguments

No arguments available

Options

No options available

ipt

Provide commands to deal with IPT

Usage

datasync ipt [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Subcommands

run

Convert IPT resources to geoparquet, register them in the DMS, publish metadata and configurations

Usage

datasync ipt run [OPTIONS]

Arguments

No arguments available

Options
Name Description Required Default
--skip-data / --no-skip-data Ignore data conversion step, perform only metadata No no-skip-data
--skip-dms / --no-skip-dms Skip publishing to DMS No no-skip-dms
--skip-csw / --no-skip-csw Skip publishing to CSW No no-skip-csw
--skip-geoapi / --no-skip-geoapi Skip publishing to pygeoapi No no-skip-geoapi
--limit Only import a certain amount of records No -
--search execute only on resources which contains that string No -
validate-iso

Validate an XML file against ISO 19115 schema

Usage

datasync ipt validate-iso [OPTIONS] FILE

Arguments
Name Description Required
FILE Yes
Options

No options available