-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add trigger to refresh materialized when organisation name changed * Add first and last measurements * Add measurement type on model * Add measurement type to uploader * Update generate wells cache with filtering generator * Update wells form to accomodate measurement type * Able to make hubeau harvester run in paralel * Fix error when doing updating well
- Loading branch information
Showing
22 changed files
with
460 additions
and
49 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.db.models.signals import post_save | ||
|
||
from gwml2.models.well import Well | ||
from gwml2.utilities import temp_disconnect_signal | ||
|
||
|
||
class Command(BaseCommand): | ||
""" Update all fixtures | ||
""" | ||
args = '' | ||
help = 'Update measurement type of well.' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
'-from', | ||
'--from', | ||
default='0', | ||
dest='from', | ||
help='From' | ||
) | ||
|
||
def handle(self, *args, **options): | ||
from gwml2.signals.well import update_well | ||
_from = int(options['from']) | ||
with temp_disconnect_signal( | ||
signal=post_save, | ||
receiver=update_well, | ||
sender=Well | ||
): | ||
for idx, well in enumerate(Well.objects.all()): | ||
if idx + 1 < _from: | ||
continue | ||
if well.is_groundwater_level is None: | ||
well.is_groundwater_level = ( | ||
'no' if well.welllevelmeasurement_set.count() == 0 | ||
else 'yes' | ||
) | ||
if well.is_groundwater_quality is None: | ||
well.is_groundwater_quality = ( | ||
'no' if well.wellqualitymeasurement_set.count() == 0 | ||
else 'yes' | ||
) | ||
well.save() |
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# Generated by Django 2.2.12 on 2020-07-03 09:03 | ||
|
||
from gwml2.migrations.sql.view_well_migrations import ViewWellMigration | ||
from django.db import migrations | ||
|
||
|
||
class Migration(ViewWellMigration): | ||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('gwml2', '0084_view_well'), | ||
] | ||
|
||
operations = [ | ||
] |
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,60 @@ | ||
# Generated by Django 3.2.20 on 2025-01-24 06:57 | ||
|
||
import django.contrib.gis.db.models.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gwml2', '0090_auto_20250103_0752'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='MaterializedViewWell', | ||
fields=[ | ||
('id', models.IntegerField(primary_key=True, serialize=False)), | ||
('ggis_uid', models.CharField(help_text='Organisation + id.', max_length=512)), | ||
('original_id', models.CharField(help_text='As recorded in the original database.', max_length=512)), | ||
('name', models.CharField(blank=True, max_length=512, null=True)), | ||
('feature_type', models.CharField(blank=True, max_length=512, null=True)), | ||
('purpose', models.CharField(blank=True, max_length=512, null=True)), | ||
('status', models.CharField(blank=True, max_length=512, null=True)), | ||
('organisation', models.CharField(blank=True, max_length=512, null=True)), | ||
('organisation_id', models.IntegerField()), | ||
('country', models.CharField(blank=True, max_length=512, null=True)), | ||
('year_of_drilling', models.PositiveIntegerField(blank=True, null=True)), | ||
('aquifer_name', models.CharField(blank=True, max_length=512, null=True)), | ||
('aquifer_type', models.CharField(blank=True, max_length=512, null=True)), | ||
('manager', models.CharField(blank=True, max_length=512, null=True)), | ||
('detail', models.CharField(blank=True, max_length=512, null=True)), | ||
('location', django.contrib.gis.db.models.fields.PointField(srid=4326)), | ||
('created_at', models.DateTimeField(blank=True, null=True)), | ||
('created_by', models.IntegerField(blank=True, null=True)), | ||
('last_edited_at', models.DateTimeField(blank=True, null=True)), | ||
('last_edited_by', models.IntegerField(blank=True, null=True)), | ||
('number_of_measurements_level', models.IntegerField()), | ||
('number_of_measurements_quality', models.IntegerField()), | ||
('first_time_measurement', models.DateTimeField(blank=True, null=True)), | ||
('last_time_measurement', models.DateTimeField(blank=True, null=True)), | ||
('is_groundwater_level', models.CharField(blank=True, max_length=8, null=True)), | ||
('is_groundwater_quality', models.CharField(blank=True, max_length=8, null=True)), | ||
], | ||
options={ | ||
'db_table': 'mv_well', | ||
'ordering': ['original_id'], | ||
'managed': False, | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='well', | ||
name='is_groundwater_level', | ||
field=models.CharField(blank=True, choices=[('yes', 'yes'), ('no', 'no')], max_length=8, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='well', | ||
name='is_groundwater_quality', | ||
field=models.CharField(blank=True, choices=[('yes', 'yes'), ('no', 'no')], max_length=8, null=True), | ||
), | ||
] |
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,9 @@ | ||
# Generated by Django 2.2.12 on 2020-07-03 09:03 | ||
|
||
from gwml2.migrations.sql.view_well_migrations import ViewWellMigration | ||
|
||
|
||
class Migration(ViewWellMigration): | ||
dependencies = [ | ||
('gwml2', '0091_auto_20250124_0657'), | ||
] |
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,27 @@ | ||
# Generated by Django 3.2.20 on 2025-01-24 08:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gwml2', '0092_view_well'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='harvester', | ||
name='harvester_class', | ||
field=models.CharField(help_text='The type of harvester that will be used.Use class with full package.', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='harvester', | ||
name='name', | ||
field=models.CharField(help_text='Name of harvester that.', max_length=100, verbose_name='Name'), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='harvester', | ||
unique_together={('harvester_class', 'name')}, | ||
), | ||
] |
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
Oops, something went wrong.