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
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
logs
.ohmg_cache
.build
docs/site
loc_insurancemaps/reference_data/shapefiles
loc_insurancemaps/cache
loc_insurancemaps/temp
mapserver.map
.temp

# allow old directory to remain here locally for uploaded files
./loc_insurancemaps

.celery_results

frontend/svelte/node_modules
frontend/svelte/public
node_modules
public

_system-configs
.env
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ Learn much more about each step [in the docs](https://ohmg.dev/docs/category/mak

All user input is tracked through registered accounts, which allows for a comprehensive understanding of user engagement and participation, as well as a complete database of all input georeferencing information, like ground control points, masks, etc.

## Dependencies
## Software Details

The Django project has a few novel dependencies:
This is a Django project, with a frontend built (mostly) with [Svelte](https://svelte.dev), using [OpenLayers](https://openlayers.org) for all map interfaces. OpenStreetMap and Mapbox are the basemap sources.

- Postgres/PostGIS - Geo-enabled relational database backend
- Django Ninja - API
- Celery + RabbitMQ/Redis - Background tasks
- Django Newsletter (optional) - Adds a newsletter to the site
### Third-party Django Apps

The frontend is build with [Svelte](https://svelte.dev) and [OpenLayers](https://openlayers.org).
- [Django Ninja](https://django-ninja.rest-framework.com) - API
- [Django Newsletter](https://github.com/jazzband/django-newsletter) - Adds a newsletter to the site

Titiler must accompany the project to furnish the map interfaces with tiles and a live preview layer during georeferencing.
### External Dependencies

- Postgres/PostGIS
- Celery + RabbitMQ
- GDAL >= 3.5
- [TiTiler](https://developmentseed.org/titiler)
7 changes: 0 additions & 7 deletions georeference/__init__.py

This file was deleted.

Empty file removed georeference/models/__init__.py
Empty file.
64 changes: 0 additions & 64 deletions georeference/utils.py

This file was deleted.

52 changes: 0 additions & 52 deletions georeference/version.py

This file was deleted.

1 change: 0 additions & 1 deletion loc_insurancemaps/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions loc_insurancemaps/logs/.gitignore

This file was deleted.

Empty file.
Empty file.
45 changes: 0 additions & 45 deletions loc_insurancemaps/management/commands/create_new_place.py

This file was deleted.

Empty file.
8 changes: 0 additions & 8 deletions ohmg/__init__.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion accounts/apps.py → ohmg/accounts/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class AccountsConfig(AppConfig):
name = 'accounts'
name = 'ohmg.accounts'
File renamed without changes.
6 changes: 3 additions & 3 deletions accounts/models.py → ohmg/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from django.contrib.auth.models import AbstractUser
from django.utils.functional import cached_property

from georeference.models.sessions import SessionBase
from georeference.models.resources import GCP
from ohmg.georeference.models.sessions import SessionBase
from ohmg.georeference.models.resources import GCP

from loc_insurancemaps.models import Volume
from ohmg.loc_insurancemaps.models import Volume

class User(AbstractUser):
class Meta:
Expand Down
4 changes: 2 additions & 2 deletions accounts/schemas.py → ohmg/accounts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Schema,
)

from georeference.schemas import SessionSchema
from loc_insurancemaps.models import Volume
from ohmg.georeference.schemas import SessionSchema
from ohmg.loc_insurancemaps.models import Volume


class UserSchema(Schema):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions api/api.py → ohmg/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
from ninja.pagination import paginate
from ninja.security import APIKeyHeader

from accounts.models import User
from accounts.schemas import UserSchema
from loc_insurancemaps.models import Volume
from content.schemas import ItemListSchema
from georeference.models.sessions import SessionBase
from georeference.schemas import (
from ohmg.accounts.models import User
from ohmg.accounts.schemas import UserSchema
from ohmg.loc_insurancemaps.models import Volume
from ohmg.content.schemas import ItemListSchema
from ohmg.georeference.models.sessions import SessionBase
from ohmg.georeference.schemas import (
FilterSessionSchema,
SessionSchema,
)
from places.models import Place
from places.schemas import PlaceSchema
from ohmg.places.models import Place
from ohmg.places.schemas import PlaceSchema

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion api/apps.py → ohmg/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ApiConfig(AppConfig):
name = 'api'
name = 'ohmg.api'
File renamed without changes.
1 change: 0 additions & 1 deletion ohmg/celeryapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
app.config_from_object('django.conf:settings', namespace="CELERY")
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
print("Request: {!r}".format(self.request))
File renamed without changes.
2 changes: 1 addition & 1 deletion content/apps.py → ohmg/content/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class ContentConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'content'
name = 'ohmg.content'
11 changes: 6 additions & 5 deletions content/models.py → ohmg/content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

The eventual migration plan is this:

loc_insurancemaps.models.Volume --> content.models.Item
loc_insurancemaps.models.Sheet --> content.models.Resource
ohmg.loc_insurancemaps.models.Volume --> content.models.Item
ohmg.loc_insurancemaps.models.Sheet --> content.models.Resource

new model --> content.models.ItemConfigPreset
This would allow an extraction of Sanborn-specific properties vs. generic item
Expand All @@ -29,9 +29,9 @@
from cogeo_mosaic.mosaic import MosaicJSON
from cogeo_mosaic.backends import MosaicBackend

from georeference.models.resources import Layer
from georeference.utils import random_alnum
from loc_insurancemaps.models import Volume, Sheet
from ohmg.georeference.models.resources import Layer
from ohmg.utils import random_alnum
from ohmg.loc_insurancemaps.models import Volume, Sheet

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -128,6 +128,7 @@ def generate_mosaic_cog(self):
to = gdal.TranslateOptions(
format="COG",
creationOptions = [
"BIGTIFF=YES",
"COMPRESS=JPEG",
"TILING_SCHEME=GoogleMapsCompatible",
],
Expand Down
32 changes: 32 additions & 0 deletions content/schemas.py → ohmg/content/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,38 @@ def resolve_profile_url(obj):
return reverse('profile_detail', args=(obj.username, ))


class ItemFullSchema(Schema):

identifier: str
title: str = Field(..., alias="__str__")
year: int = None
loaded_by: Optional[UserSchema]
status: str = None
progress: dict
extent: tuple = None
multimask: dict = None
mosaic_preference: str = None

def resolve_extent(obj):
return obj.extent.extent if obj.extent else None

def resolve_progress(obj):
items = obj.sort_lookups()
unprep_ct = len(items['unprepared'])
prep_ct = len(items['prepared'])
georef_ct = len(items['georeferenced'])
percent = 0
if georef_ct > 0:
percent = int((georef_ct / (unprep_ct + prep_ct + georef_ct)) * 100)

return {
"unprep_ct": unprep_ct,
"prep_ct": prep_ct,
"georef_ct": georef_ct,
"percent": percent,
}


class ItemListSchema(Schema):
identifier: str
title: str = Field(..., alias="__str__")
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/apps.py → ohmg/frontend/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class FrontendConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'frontend'
name = 'ohmg.frontend'
Loading