Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lexara-prime-ai committed Jul 5, 2024
1 parent c4d428a commit fe5a793
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 59 deletions.
57 changes: 0 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 <wspr> spots.
#[get("/api/spots")]
async fn get_wspr_spots() -> Result<Json<Vec<WsprSpot>>, status::Custom<String>> {
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:
Expand Down
6 changes: 6 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
Expand All @@ -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?
Expand All @@ -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?
Expand All @@ -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?
Expand Down
20 changes: 20 additions & 0 deletions scripts/bash/build_wheel.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions scripts/bash/python_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
19 changes: 19 additions & 0 deletions scripts/bash/rust_deps.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fe5a793

Please sign in to comment.