-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/33_feature' into develop
- Loading branch information
Showing
17 changed files
with
678 additions
and
419 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
01_Data_raw/Water_Quality/Guana_WQ/guana_data_dictionary_updateGK.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
######################################################################## | ||
########## NERRS Science Transfer project - GTMNERR ############# | ||
######################################################################## | ||
|
||
# Geraldine Klarenberg, PhD | ||
# [email protected] | ||
# 12 August 2024 | ||
|
||
# Load packages | ||
library(tidyverse) | ||
|
||
# Merge WIN and WQ data into one | ||
|
||
WIN <- readRDS("03_Data_for_app/WIN.Rds") | ||
WQ_GTMNERR <- readRDS("03_Data_for_app/WQ.Rds") | ||
|
||
# Make WQ_GTMNERR long format as well, just like WIN | ||
# Having a column for the dates is advisable though, as it is a separate data | ||
# type. Update that later, not right now. | ||
|
||
# First make sure that every row has a UNID and also add a column for the data | ||
# source / provider | ||
WQ_GTMNERR <- WQ_GTMNERR %>% | ||
mutate(data_source = "GTMNERR") %>% | ||
arrange(UNID, StationCode, SampleDate, ComponentShort) | ||
|
||
for (i in 1:nrow(WQ_GTMNERR)){ | ||
if (is.na(WQ_GTMNERR$UNID[i])){ | ||
WQ_GTMNERR$UNID[i] <- WQ_GTMNERR$UNID[i-1] + 1 | ||
} | ||
} | ||
# Check there are no duplicates | ||
sum(duplicated(WQ_GTMNERR$UNID)) | ||
|
||
# Add a geometry column, to later use for clicking markers (we might change this) | ||
WQ_GTMNERR <- st_as_sf(WQ_GTMNERR, coords = c("Longitude", "Latitude"), | ||
crs = 4326, remove = FALSE) | ||
# Turn back into dataframe with geometry as a column | ||
WQ_GTMNERR <- as.data.frame(WQ_GTMNERR) | ||
|
||
WQ_GTMNERR_long <- WQ_GTMNERR %>% | ||
mutate(across(everything(), as.character)) %>% | ||
mutate_all(~ na_if(., "")) %>% | ||
pivot_longer(cols = -UNID, | ||
names_to = "variable", | ||
values_to = "value") | ||
|
||
# How to deal with UNID when merging? Start counting anew (or add however far the | ||
# one dataset is?) | ||
|
||
min(as.numeric(WQ_GTMNERR_long$UNID)) # 1 | ||
max(as.numeric(WQ_GTMNERR_long$UNID)) # 5016 (used to be 17098?) | ||
|
||
min(as.numeric(WIN$RowID)) # 55135 | ||
max(as.numeric(WIN$RowID)) # 3677602 | ||
# Appears there will be no overlap. Merge. | ||
|
||
WQ_GTMNERR_long <- WQ_GTMNERR_long %>% | ||
rename(RowID = UNID) | ||
|
||
WQ_all <- WIN %>% | ||
full_join(WQ_GTMNERR_long) | ||
|
||
unique(WQ_all$variable) | ||
|
||
# Save data | ||
saveRDS(WQ_all, "03_Data_for_app/WQ_all.Rds") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
data_source,original_name,dashboard_name | ||
WIN,Organization ID,OrganizationID | ||
WIN,Monitoring Location ID,MonitoringLocationID | ||
WIN,HUC12 Name,HUC12Name | ||
WIN,Project ID,ProjectID | ||
WIN,Activity ID,ActivityID | ||
WIN,Activity Type,SampleType | ||
WIN,Activity Start Date Time,SampleDate | ||
WIN,Activity End Date Time,ActivityEndDateTime | ||
WIN,Activity Time Zone,ActivityTimeZone | ||
WIN,Media,Media | ||
WIN,Matrix,Matrix | ||
WIN,Sample Collection Type,SampleCollectionType | ||
WIN,Sampling Agency Name,SamplingAgencyName | ||
WIN,SampleCollectionEquipmentName,SampleCollectionEquipmentName | ||
WIN,Activity Depth,ActivityDepth | ||
WIN,Activity Depth Unit,ActivityDepthUnit | ||
WIN,Relative Depth,RelativeDepth | ||
WIN,Activity Top Depth,ActivityTopDepth | ||
WIN,Activity Bottom Depth,ActivityBottomDepth | ||
WIN,Activity Depth Top Bottom Unit,ActivityDepthTopBottomUnit | ||
WIN,Total Depth,TotalDepth | ||
WIN,Total Depth Unit,TotalDepthUnit | ||
WIN,Activity Representative Ind,ActivityRepresentativeInd | ||
WIN,Activity Comments,ActivityComments | ||
WIN,Sampler Name,SamplerName | ||
WIN,Field Blank Batch ID,FieldBlankBatchID | ||
WIN,Equipment Blank Batch ID,EquipmentBlankBatchID | ||
WIN,Trip Blank Batch ID,TripBlankBatchID | ||
WIN,Master Activity ID,MasterActivityID | ||
WIN,Activity Loaded Date,ActivityLoadedDate | ||
WIN,Activity Updated Date,ActivityUpdatedDate | ||
WIN,DEP Result ID,DEPResultID | ||
WIN,Org Result ID,OrgResultID | ||
WIN,DEP Analyte Group,DEPAnalyteGroup | ||
WIN,DEP Analyte Name,ComponentLong | ||
WIN,ADaPT Analyte ID,ADaPTAnalyteID | ||
WIN,Org Analyte Name,OrgAnalyteName | ||
WIN,Org Result Value,OrgResultValue | ||
WIN,Org Result Unit,OrgResultUnit | ||
WIN,Org MDL,OrgMDL | ||
WIN,Org PQL,OrgPQL | ||
WIN,Org Detection Unit,OrgDetectionUnit | ||
WIN,DEP Result Value Number,Result | ||
WIN,DEP Result Value Text,DEPResultValueText | ||
WIN,DEP Result Unit,Unit | ||
WIN,DEP MDL,DEPMDL | ||
WIN,DEP PQL,DEPPQL | ||
WIN,Value Qualifier,ValueQualifier | ||
WIN,Sample Fraction,SampleFraction | ||
WIN,Prep Method,PrepMethod | ||
WIN,Preparation Date Time,PreparationDateTime | ||
WIN,Preparation Time Zone,PreparationTimeZone | ||
WIN,Analysis Method,AnalysisMethod | ||
WIN,Analysis Date Time,AnalysisDateTime | ||
WIN,Analysis Time Zone,AnalysisTimeZone | ||
WIN,Lab ID,LabID | ||
WIN,Lab Name,LabName | ||
WIN,Lab Accreditation Authority,LabAccreditationAuthority | ||
WIN,Result Comments,ResultComments | ||
WIN,Lab Sample ID,LabSampleID | ||
WIN,Method Batch ID,MethodBatchID | ||
WIN,Analytical Batch ID,AnalyticalBatchID | ||
WIN,Dilution,Dilution | ||
WIN,Percent Moisture,PercentMoisture | ||
WIN,Percent Recovery,PercentRecovery | ||
WIN,Relative Percent Difference,RelativePercentDifference | ||
WIN,Error,Error | ||
WIN,Target Species,TargetSpecies | ||
WIN,Finfish Size,FinfishSize | ||
WIN,Finfish Unit,FinfishUnit | ||
WIN,Result Value Type,ResultValueType | ||
WIN,Statistical Base,StatisticalBase | ||
WIN,Audit Censored Decisions,AuditCensoredDecisions | ||
WIN,Result Loaded Date,ResultLoadedDate | ||
WIN,Result Updated Date,ResultUpdatedDate | ||
WIN,RowID,RowID | ||
WIN,LocationID,LocationID | ||
WIN,ProgramID,ProgramID | ||
WIN,Station ID,StationID | ||
WIN,Station Name,StationName | ||
WIN,Station Type,StationType | ||
WIN,County,County | ||
WIN,Start Date,StartDate | ||
WIN,End Date,EndDate | ||
WIN,Location_1,Latitude | ||
WIN,Location_2,Longitude | ||
GTMNERR,UNID,UNID | ||
GTMNERR,StationCode,StationCode | ||
GTMNERR,SampleDate,SampleDate | ||
GTMNERR,SampleType,SampleType | ||
GTMNERR,Lat,Latitude | ||
GTMNERR,Long,Longitude | ||
GTMNERR,ComponentShort,ComponentShort | ||
GTMNERR,ComponentLong,ComponentLong | ||
GTMNERR,Result,Result | ||
GTMNERR,Remark,Remark | ||
GTMNERR,Flag,Flag | ||
GTMNERR,Unit,Unit | ||
GTMNERR,MRL,MRL | ||
GTMNERR,MDL,MDL | ||
GTMNERR,Dilution,Dilution | ||
GTMNERR,PQL,PQL | ||
GTMNERR,DateRecieved,DateRecieved | ||
GTMNERR,DateAnalyzed,DateAnalyzed | ||
GTMNERR,TestComments,TestComments | ||
GTMNERR,AnalysisMethod,AnalysisMethod | ||
GTMNERR,Lab ID,LabID | ||
GTMNERR,Lab Accredidation Authority,LabAccredidationAuthority | ||
GTMNERR,Laboratory,Laboratory | ||
GTMNERR,RQ#,RQ# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Guana Dashboard development | ||
13 August 2024 | ||
|
||
For the water quality page, to streamline showing all the WQ data on one page, I manually created | ||
a lookup table to change the headers of the separate files so they are the same. This way we can use | ||
merge the datasets and use the existing functions on them. | ||
|
||
The headers comfr from the files App_dev/01_Data_raw/Water_Quality/WIN/WIN_data_merged_20240501.csv and | ||
App_dev/01_Data_raw/Water_Quality/Guana_WQ/Guana_masterdata.xlsx. | ||
|
||
1. Copy-pasted the header names to App_dev/03_Data_for_app/WQ_lookup_names.csv and named the column original_name | ||
2. Added a column data_sources with either WIN or GTMNERR | ||
3. Created a column dashboard_name and copied all the names from original_name to it | ||
4. For now (08/13/2024) I am only changing latitude, longitude, dates, sample type, components/analytes measured (DEP, not org). For visualization purposes. We can rename the rest later (analytes themselves will | ||
also need to be renamed, as well as info on station names and types). | ||
5. For the new names I also removed the spaces (because R inserts points there). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.