From fe5a7938c38b8fa69c6b0ba21a73e910c9ae02d2 Mon Sep 17 00:00:00 2001 From: lexara-prime-ai Date: Fri, 5 Jul 2024 14:28:49 +0000 Subject: [PATCH] Minor updates --- README.md | 57 ------------------------------------- docs/README.md | 6 ++++ scripts/bash/build_wheel.sh | 20 +++++++++++++ scripts/bash/python_deps.sh | 3 +- scripts/bash/rust_deps.sh | 19 +++++++++++++ 5 files changed, 46 insertions(+), 59 deletions(-) create mode 100755 scripts/bash/build_wheel.sh create mode 100755 scripts/bash/rust_deps.sh diff --git a/README.md b/README.md index 33119d0..8f9d2f5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,5 @@ # WSPR CDK -## Project Directory Structure(Cargo) - -```sh -wspr_cdk -│ -├── Cargo.toml -├── wspr_cdk_server -│ ├── Cargo.toml -│ └── src -│ └── main.rs -├── python_wrapper -│ ├── Cargo.toml -│ └── src -│ └── lib.rs -└── windows_container - ├── Cargo.toml - └── src - └── main.rs -``` - `wspr_cdk` provides an abstraction for accessing and analyzing **WSPR** (_Weak Signal Propagation Reporter_) real-time spot data. This crate allows you to perform queries and fetch data from the WSPR database with ease. ## Prerequisites @@ -183,43 +163,6 @@ ClickHouseState { The server component allows you to access and share real-time WSPR data via HTTP. Below is a snippet of the server component source code: -```rust -#[macro_use] -extern crate rocket; - -use anyhow::Error; -use rocket::http::Status; -use rocket::response::{content, status}; -use rocket::serde::json::Json; -use serde::{Deserialize, Serialize}; -use std::result::Result::{Err, Ok}; - -// Required [modules]. -use wspr_cdk::{services::prelude::*, state::prelude::*}; - -/// Get all spots. -#[get("/api/spots")] -async fn get_wspr_spots() -> Result>, status::Custom> { - let mut state = ClickHouseClient::init(); - let _session = session_manager::SessionManager::new(); - - match ClickHouseClient::dispatch(&mut state, ClickHouseAction::Get, "10", "JSON").await { - Ok(Some(spots)) => Ok(Json(spots)), - Ok(None) => Err(status::Custom(Status::NotFound, "No spots found".into())), - Err(e) => Err(status::Custom( - Status::InternalServerError, - format!("Failed to fetch spots: {:?}", e), - )), - } -} - -#[launch] -#[rocket::main] -async fn rocket() -> _ { - rocket::build().mount("/", routes![get_wspr_spots]) -} -``` - ### Sample cURL Request To fetch WSPR spots using the server component, you can use the following cURL command: diff --git a/docs/README.md b/docs/README.md index 4a8d627..dd397c1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,10 +5,12 @@ - What is the total number of spots recorded in a given time period? - How many unique receivers and transmitters are there in the data? + 2. **Time-Based Analysis:** - What is the distribution of spots over different times of the day or days of the week? - How does the number of spots vary over different months? + 3. **Geographical Analysis:** - What are the most common receiver and transmitter locations (latitude and longitude)? @@ -20,10 +22,12 @@ - How does the signal-to-noise ratio (SNR) vary with distance? - What is the relationship between power and distance? + 2. **Frequency and Band Analysis:** - How does the frequency distribution look like across different bands? - Which band has the highest average SNR? + 3. **Performance Analysis:** - Which version of the software (Version) shows the best performance in terms of SNR? @@ -34,6 +38,7 @@ - How does the signal propagation vary between different times of the day (e.g., day vs. night)? - How does the performance vary across different months? + 2. **Geographical Comparison:** - How does the SNR differ between different geographical regions? @@ -45,6 +50,7 @@ - Can we identify any patterns in the data that suggest certain times or conditions are better for signal transmission? - Are there any anomalies or outliers in the data that require further investigation? + 2. **Predictive Analysis:** - Can we predict the SNR based on other variables such as distance, power, frequency, and band? diff --git a/scripts/bash/build_wheel.sh b/scripts/bash/build_wheel.sh new file mode 100755 index 0000000..5da60c4 --- /dev/null +++ b/scripts/bash/build_wheel.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +function is_installed() { + pip show "$1" &> /dev/null + return $? +} + +# Check if maturin is installed. +if ! command -v maturin &> /dev/null; then + echo "Maturin is not installed. Please install maturin first." + exit 1 +fi + +# Check if the module python_wrapper exists. +if ! is_installed "python_wrapper"; then + echo "Module python_wrapper not found. Running maturin develop..." + maturin develop -m python_wrapper/Cargo.toml +else + echo "Module python_wrapper is already installed." +fi diff --git a/scripts/bash/python_deps.sh b/scripts/bash/python_deps.sh index 51cab42..30c38ad 100755 --- a/scripts/bash/python_deps.sh +++ b/scripts/bash/python_deps.sh @@ -30,7 +30,7 @@ else fi # Modules that will be installed/upgraded. -modules=("modal" "mkdocs" "maturin" "patchelf" "tableauhyperapi" "google-api-python-client" "google-auth-httplib2" "google-auth-oauthlib") +modules=("modal" "mkdocs" "maturin" "tableauhyperapi" "google-api-python-client" "google-auth-httplib2" "google-auth-oauthlib") echo "${BLUE}Installing dependencies: ${modules[*]}...${NORMAL}" pip install "${modules[@]}" --upgrade @@ -52,7 +52,6 @@ declare -A module_import_map=( ["modal"]="modal" # To Do -> Update Docker configuration to include modal cli configuration. ["mkdocs"]="mkdocs" ["maturin"]="maturin" - ["patchelf"]="patchelf" ["tableauhyperapi"]="tableauhyperapi" ["google-api-python-client"]="googleapiclient" ["google-auth-httplib2"]="google_auth_httplib2" diff --git a/scripts/bash/rust_deps.sh b/scripts/bash/rust_deps.sh new file mode 100755 index 0000000..5234f60 --- /dev/null +++ b/scripts/bash/rust_deps.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +function command_exists() { + command -v "$1" &> /dev/null + return $? +} + +# Check if Rust is already installed. +if command_exists rustc; then + echo "Rust is already installed." +else + echo "Rust is not installed. Installing Rust..." + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + + . "$HOME/.cargo/env" + + echo "Rust installation completed." +fi