mirror of
https://github.com/dathere/ckan_geoconnex_bulk_runner.git
synced 2026-07-05 15:12:20 +00:00
feat: initial scaffolding for ckan_geoconnex_bulk_runner
This commit is contained in:
commit
71370c3d7c
6 changed files with 2401 additions and 0 deletions
31
src/main.rs
Normal file
31
src/main.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
mod utils;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let ckan = ckanaction::CKAN::builder()
|
||||
.url("https://data.dathere.com")
|
||||
.build();
|
||||
// TODO: Paginate through package_list and run package_show for each package
|
||||
// If about exists then construct JSON-LD and validate then output JSON-LD to stdout on a new line
|
||||
let response = ckan.package_show().id("".to_string()).call().await?;
|
||||
|
||||
let result = response
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.get("result")
|
||||
.unwrap()
|
||||
.as_object()
|
||||
.unwrap();
|
||||
if let Some(geoconnex_about) = result.get("geoconnex_about") {
|
||||
// Check if at least one valid reference feature exists in dataset metadata
|
||||
}
|
||||
// TODO: Construct JSON-LD if valid `about`
|
||||
// TODO: Validate constructed JSON-LD against JSON schema
|
||||
// TODO: Print JSON-LD to new line
|
||||
|
||||
println!("{result:#?}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
14
src/utils.rs
Normal file
14
src/utils.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use serde_json::json;
|
||||
|
||||
async fn construct_jsonld(metadata: serde_json::Value) -> serde_json::Value {}
|
||||
|
||||
async fn get_dataset_schema() -> serde_json::Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@context": {"type": ["string", "object"]},
|
||||
"@type": {"const": "Dataset"}
|
||||
},
|
||||
"required": []
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue