Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/django_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
- name: Install GDAL
run: |
sudo apt-get update
sudo apt-get install -y gdal-bin libgdal-dev python3-gdal
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
Expand Down
1 change: 1 addition & 0 deletions api-rework/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
protobuf
devops
14 changes: 7 additions & 7 deletions api-rework/client/src/activities/form-viewer/FormViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FormViewer = ({ formData }) => {
<TextInput label={'subtype'} value={formData?.subtype} />
<TextInput label={'form status'} value={formData?.form_status} />
<FormMap
// TODO: geojson={} ADD GEOJSON WHEN READY
geojson={formData?.shape}
/>
<TextInput label={'latitude'} value={formData?.latitude} />
<TextInput label={'longitude'} value={formData?.longitude} />
Expand All @@ -49,38 +49,38 @@ const FormViewer = ({ formData }) => {
</Fieldset>
<Fieldset label={'project codes'} small>
{formData?.projects.map(({ description }) => (
<TextInput value={description} />
<TextInput key={description} value={description} />
))}
</Fieldset>
<Fieldset label={'employers'} small>
{formData?.employer.map(({ employer }) => (
<TextInput value={employer} />
<TextInput key={employer} value={employer} />
))}
</Fieldset>
<Fieldset label={'funding agencies'} small>
{formData?.funding_agencies.map(({ invasive_species_agency_code }) => (
<TextInput value={invasive_species_agency_code} />
<TextInput key={invasive_species_agency_code} value={invasive_species_agency_code} />
))}
</Fieldset>
<Fieldset label={'jurisdictions'} small>
{formData?.jurisdictions.map(({ jurisdiction, percent_covered }) => (
<div className="group-wrap">
<div key={jurisdiction} className="group-wrap">
<TextInput label={'jurisdiction'} value={jurisdiction} />
<TextInput label={'percent covered'} value={percent_covered} />
</div>
))}
</Fieldset>
<Fieldset label={'participants'} small>
{formData?.participants.map(({ name, pac_number }) => (
<div className="group-wrap">
<div key={pac_number} className="group-wrap">
{pac_number && <TextInput label={'PAC number'} value={pac_number} />}
<TextInput label={'name'} value={name} />
</div>
))}
</Fieldset>
<Fieldset label={'Linked Records'}>
{formData?.linked_activities?.map(({ full, short_id }) => (
<div className="group-wrap">
<div key={short_id} className="group-wrap">
<TextInput label={'Short ID'} value={short_id} />
<TextInput label={'Full'} value={full} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion api-rework/client/src/activities/json_viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const JSONViewer: React.FC<JSONViewerProps> = ({ data, helpText, diffCandidates
<input
type={'checkbox'}
checked={diffsEnabled.includes(candidate.title)}
onClick={() => toggleDiff(candidate.title)}
onChange={() => toggleDiff(candidate.title)}
/>
Show Diff with {candidate.title}
</React.Fragment>
Expand Down
28 changes: 16 additions & 12 deletions api-rework/client/src/common-components/form-map/FormMap.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { useEffect, useRef, useState } from 'react';
import { useEffect, useRef } from 'react';
import maplibregl, { LngLatBoundsLike, LngLatLike } from 'maplibre-gl';
import { centroid } from '@turf/centroid';
import { bbox } from '@turf/bbox';

import './formMap.css';

type PropTypes = {
geojson?: GeoJSON.Polygon | GeoJSON.Feature;
geojson: GeoJSON.Polygon | GeoJSON.Feature;
};

const FormMap = ({ geojson }: PropTypes) => {
const SRC = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}';
const mapRef = useRef<HTMLDivElement>(null);
const [map, setMap] = useState<maplibregl.Map>();
const map= useRef<maplibregl.Map | undefined>(undefined);

const mapCenter: LngLatLike = (() => {
if (!geojson) return [-121, 54] as LngLatLike;
Expand All @@ -20,7 +21,7 @@ const FormMap = ({ geojson }: PropTypes) => {

useEffect(() => {
// Init Map after load
setMap(
map.current =
new maplibregl.Map({
container: 'map',
center: mapCenter,
Expand All @@ -30,7 +31,8 @@ const FormMap = ({ geojson }: PropTypes) => {
'raster-tiles': {
type: 'raster',
tiles: [SRC],
tileSize: 256
tileSize: 256,
maxzoom: 18
}
},
layers: [
Expand All @@ -42,20 +44,21 @@ const FormMap = ({ geojson }: PropTypes) => {
],
version: 8
}
})
}
);
}, []);
}, [geojson]);

useEffect(() => {
// Apply Geometry + Layer
if (!map || !geojson) return;
map?.on('load', () => {
if (!map.current || !geojson) return;

map.current.on('load', () => {
if (geojson) {
map?.addSource('form-feature', {
map.current?.addSource('form-feature', {
type: 'geojson',
data: geojson
});
map?.addLayer({
map.current?.addLayer({
id: 'form-feature',
type: 'fill',
source: 'form-feature',
Expand All @@ -66,12 +69,13 @@ const FormMap = ({ geojson }: PropTypes) => {
}
});
const bounds = bbox(geojson) as LngLatBoundsLike;
map.fitBounds(bounds, {
map.current?.fitBounds(bounds, {
padding: 10,
minZoom: 8
});
}
});

}, [map]);
return (
<div>
Expand Down
1 change: 1 addition & 0 deletions api-rework/client/src/common-components/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ header {
border-bottom: 1pt solid black;
font-family: Calibri, sans-serif;
color: white;
z-index: 100;

h1,
p {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"created_timestamp": "2026-01-01 12:01:00-08:00",
"received_timestamp": "2026-01-01 12:02:00-08:00",
"subtype": "Observation_Plant_Terrestrial",
"comment": "The test looks for this comment"
"comment": "The test looks for this comment",
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -18,7 +19,8 @@
"created_timestamp": "2026-01-01 12:01:00-08:00",
"received_timestamp": "2026-01-01 12:02:00-08:00",
"subtype": "Observation_Plant_Terrestrial",
"comment": "Nothing here"
"comment": "Nothing here",
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Biocontrol_Collection",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Monitoring_Biocontrol_Dispersal_Plant_Terrestrial",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -34,7 +35,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Monitoring_Biocontrol_Release_Plant_Terrestrial",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Monitoring_Chemical_Plant_Terrestrial_Aquatic",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -34,7 +35,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Monitoring_Mechanical_Plant_Terrestrial_Aquatic",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -34,7 +35,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Observation_Plant_Aquatic",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Observation_Plant_Terrestrial",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Treatment_Chemical_Plant_Aquatic",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Treatment_Mechanical_Plant_Aquatic",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"batch_row_id": 34,
"linked_activities": [
"CD542709-F767-402F-818E-117B3FBC797D"
]
],
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand All @@ -35,7 +36,8 @@
"received_timestamp": "2026-01-07T23:44:38.919Z",
"subtype": "Biocontrol_Release",
"batch_id": 56,
"batch_row_id": 78
"batch_row_id": 78,
"shape": "SRID=4326;POLYGON ((-122.177141614583 52.1532521915262, -122.177829032404 52.1531151489405, -122.178253871019 52.1527563687912, -122.178253859939 52.1523128961334, -122.177829014477 52.1519541224493, -122.177141614583 52.1518170838594, -122.176454214689 52.1519541224493, -122.176029369227 52.1523128961334, -122.176029358147 52.1527563687912, -122.176454196762 52.1531151489405, -122.177141614583 52.1532521915262))"
}
},
{
Expand Down
Loading
Loading