Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Back-End]: Fix or correct datamodels #120

Merged
merged 4 commits into from
Oct 31, 2024
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
8 changes: 5 additions & 3 deletions api/bro_upload/templates/registration_GMW_Construction.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
<ns2:localVerticalReferencePoint codeSpace="urn:bro:gmw:LocalVerticalReferencePoint">{{ sourcedocs_data.localVerticalReferencePoint }}</ns2:localVerticalReferencePoint>
<ns2:offset uom="m">{{ sourcedocs_data.offset }}</ns2:offset>
<ns2:verticalDatum codeSpace="urn:bro:gmw:VerticalDatum">{{ sourcedocs_data.verticalDatum }}</ns2:verticalDatum>
{% if sourcedocs_data.groundLevelPosition %}
<ns2:groundLevelPosition uom="m">{{ sourcedocs_data.groundLevelPosition }}</ns2:groundLevelPosition>
{% endif %}
<ns2:groundLevelPositioningMethod codeSpace="urn:bro:gmw:GroundLevelPositioningMethod">{{ sourcedocs_data.groundLevelPositioningMethod }}</ns2:groundLevelPositioningMethod>
</ns:deliveredVerticalPosition>
{% for monitoringtube in sourcedocs_data.monitoringTubes %}
Expand Down Expand Up @@ -67,10 +69,10 @@
<ns2:sedimentSumpLength uom="m">{{ monitoringtube.sedimentSumpLength }}</ns2:sedimentSumpLength>
</ns:sedimentSump>
{% endif %}
{% for geoohmcable in monitoringtube.geoohmcables %}
{% for geoOhmCable in monitoringtube.geoOhmCables %}
<ns:geoOhmCable>
<ns:cableNumber>{{ geoohmcable.cableNumber }}</ns:cableNumber>
{% for electrode in geoohmcable.electrodes %}
<ns:cableNumber>{{ geoOhmCable.cableNumber }}</ns:cableNumber>
{% for electrode in geoOhmCable.electrodes %}
<ns:electrode>
<ns2:electrodeNumber>{{ electrode.electrodeNumber }}</ns2:electrodeNumber>
<ns2:electrodePackingMaterial codeSpace="urn:bro:gmw:ElectrodePackingMaterial">{{ electrode.electrodePackingMaterial }}</ns2:electrodePackingMaterial>
Expand Down
8 changes: 5 additions & 3 deletions api/bro_upload/templates/replace_GMW_construction.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<ns2:localVerticalReferencePoint codeSpace="urn:bro:gmw:LocalVerticalReferencePoint">{{ sourcedocs_data.localVerticalReferencePoint }}</ns2:localVerticalReferencePoint>
<ns2:offset uom="m">{{ sourcedocs_data.offset }}</ns2:offset>
<ns2:verticalDatum codeSpace="urn:bro:gmw:VerticalDatum">{{ sourcedocs_data.verticalDatum }}</ns2:verticalDatum>
{% if sourcedocs_data.groundLevelPosition %}
<ns2:groundLevelPosition uom="m">{{ sourcedocs_data.groundLevelPosition }}</ns2:groundLevelPosition>
{% endif %}
<ns2:groundLevelPositioningMethod codeSpace="urn:bro:gmw:GroundLevelPositioningMethod">{{ sourcedocs_data.groundLevelPositioningMethod }}</ns2:groundLevelPositioningMethod>
</ns:deliveredVerticalPosition>
{% for monitoringtube in sourcedocs_data.monitoringTubes %}
Expand Down Expand Up @@ -69,10 +71,10 @@
<ns2:sedimentSumpLength uom="m">{{ monitoringtube.sedimentSumpLength }}</ns2:sedimentSumpLength>
</ns:sedimentSump>
{% endif %}
{% for geoohmcable in monitoringtube.geoohmcables %}
{% for geoOhmCable in monitoringtube.geoOhmCables %}
<ns:geoOhmCable>
<ns:cableNumber>{{ geoohmcable.cableNumber }}</ns:cableNumber>
{% for electrode in geoohmcable.electrodes %}
<ns:cableNumber>{{ geoOhmCable.cableNumber }}</ns:cableNumber>
{% for electrode in geoOhmCable.electrodes %}
<ns:electrode>
<ns2:electrodeNumber>{{ electrode.electrodeNumber }}</ns2:electrodeNumber>
<ns2:electrodePackingMaterial codeSpace="urn:bro:gmw:ElectrodePackingMaterial">{{ electrode.electrodePackingMaterial }}</ns2:electrodePackingMaterial>
Expand Down
11 changes: 6 additions & 5 deletions api/bro_upload/upload_datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class MonitoringTube(BaseModel):
tubeType: str
artesianWellCapPresent: str
sedimentSumpPresent: str
numberOfGeoOhmCables: str | int
numberOfGeoOhmCables: str | int # Should this not be derived from 'geoohmcables'
tubeTopDiameter: str | float | None = None
variableDiameter: str | float
tubeStatus: str
Expand All @@ -97,22 +97,23 @@ class MonitoringTube(BaseModel):
tubeMaterial: str
glue: str
screenLength: str | float
screenProtection: str | None = None
sockMaterial: str
plainTubePartLength: str | float
sedimentSumpLength: str | float | None = None
geoohmcables: list[GeoOhmCable] | None = None
geoOhmCables: list[GeoOhmCable] | None = None


class GMWConstruction(BaseModel):
objectIdAccountableParty: str
deliveryContext: str
constructionStandard: str
initialFunction: str
numberOfMonitoringTubes: str | int
numberOfMonitoringTubes: str | int # Should this not be derived from 'monitoringTubes'
groundLevelStable: str
wellStability: str | None = None
owner: str
maintenanceResponsibleParty: str
owner: str | None = None
maintenanceResponsibleParty: str | None = None
wellHeadProtector: str
wellConstructionDate: str
deliveredLocation: str
Expand Down
57 changes: 57 additions & 0 deletions api/migrations/0050_alter_uploadtask_registration_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Generated by Django 5.0.4 on 2024-10-31 09:27

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("api", "0049_alter_inviteuser_nens_auth_client_invitation"),
]

operations = [
migrations.AlterField(
model_name="uploadtask",
name="registration_type",
field=models.CharField(
choices=[
("GMN_StartRegistration", "GMN_StartRegistration"),
("GMN_MeasuringPoint", "GMN_MeasuringPoint"),
("GMN_MeasuringPointEndDate", "GMN_MeasuringPointEndDate"),
("GMN_TubeReference", "GMN_TubeReference"),
("GMN_Closure", "GMN_Closure"),
("GMW_Construction", "GMW_Construction"),
("GMW_ElectrodeStatus", "GMW_ElectrodeStatus"),
("GMW_GroundLevel", "GMW_GroundLevel"),
("GMW_GroundLevelMeasuring", "GMW_GroundLevelMeasuring"),
("GMW_Insertion", "GMW_Insertion"),
("GMW_Lengthening", "GMW_Lengthening"),
("GMW_Shortening", "GMW_Shortening"),
("GMW_Positions", "GMW_Positions"),
("GMW_PositionsMeasuring", "GMW_PositionsMeasuring"),
("GMW_Shift", "GMW_Shift"),
("GMW_Maintainer", "GMW_Maintainer"),
("GMW_Owner", "GMW_Owner"),
("GMW_Removal", "GMW_Removal"),
("GMW_TubeStatus", "GMW_TubeStatus"),
("GMW_WellHeadProtector", "GMW_WellHeadProtector"),
("GAR", "GAR"),
("GLD_StartRegistration", "GLD_StartRegistration"),
("GLD_Addition", "GLD_Addition"),
("GLD_Closure", "GLD_Closure"),
("FRD_StartRegistration", "FRD_StartRegistration"),
(
"FRD_GEM_MeasurementConfiguration",
"FRD_GEM_MeasurementConfiguration",
),
("FRD_GEM_Measurement", "GLD_CloFRD_GEM_Measurementsure"),
(
"FRD_EMM_InstrumentConfiguration",
"FRD_EMM_InstrumentConfiguration",
),
("FRD_EMM_Measurement", "FRD_EMM_Measurement"),
("FRD_Closure", "FRD_Closure"),
],
max_length=235,
),
),
]
42 changes: 42 additions & 0 deletions gmw/migrations/0014_monitoringtube_screen_protection_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 5.0.4 on 2024-10-31 09:26

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("gmw", "0013_monitoringtube_sediment_sump_length"),
]

operations = [
migrations.AddField(
model_name="monitoringtube",
name="screen_protection",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="gmw",
name="ground_level_position",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="gmw",
name="owner",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="gmw",
name="well_stability",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="monitoringtube",
name="sediment_sump_length",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="monitoringtube",
name="tube_top_diameter",
field=models.CharField(blank=True, max_length=100, null=True),
),
]
11 changes: 6 additions & 5 deletions gmw/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class GMW(models.Model):
initial_function = models.CharField(max_length=100, null=True)
removed = models.CharField(max_length=100, null=True)
ground_level_stable = models.CharField(max_length=100, null=True)
well_stability = models.CharField(max_length=100, null=True)
well_stability = models.CharField(max_length=100, null=True, blank=True)
nitg_code = models.CharField(max_length=100, null=True)
well_code = models.CharField(max_length=100, null=True)
owner = models.CharField(max_length=100, null=True)
owner = models.CharField(max_length=100, null=True, blank=True)
well_head_protector = models.CharField(max_length=100, null=True)
delivered_location = models.CharField(max_length=100, null=True)
local_vertical_reference_point = models.CharField(max_length=100, null=True)
offset = models.CharField(max_length=100, null=True)
vertical_datum = models.CharField(max_length=100, null=True)
ground_level_position = models.CharField(max_length=100, null=True)
ground_level_position = models.CharField(max_length=100, null=True, blank=True)
ground_level_positioning_method = models.CharField(max_length=100, null=True)
standardized_location = models.CharField(max_length=100, null=True)
object_registration_time = models.DateTimeField(null=True)
Expand Down Expand Up @@ -62,10 +62,10 @@ class MonitoringTube(models.Model):
tube_type = models.CharField(max_length=100, null=True)
artesian_well_cap_present = models.CharField(max_length=100, null=True)
sediment_sump_present = models.CharField(max_length=100, null=True)
sediment_sump_length = models.CharField(max_length=100, null=True)
sediment_sump_length = models.CharField(max_length=100, null=True, blank=True)
number_of_geo_ohm_cables = models.CharField(max_length=100, null=True)
geo_ohm_cables = JSONField("Geoohm Cables", default=dict, blank=True)
tube_top_diameter = models.CharField(max_length=100, null=True)
tube_top_diameter = models.CharField(max_length=100, null=True, blank=True)
variable_diameter = models.CharField(max_length=100, null=True)
tube_status = models.CharField(max_length=100, null=True)
tube_top_position = models.CharField(max_length=100, null=True)
Expand All @@ -76,6 +76,7 @@ class MonitoringTube(models.Model):
tube_material = models.CharField(max_length=100, null=True)
glue = models.CharField(max_length=100, null=True)
screen_length = models.CharField(max_length=100, null=True)
screen_protection = models.CharField(max_length=100, null=True, blank=True)
sock_material = models.CharField(max_length=100, null=True)
screen_top_position = models.CharField(max_length=100, null=True)
screen_bottom_position = models.CharField(max_length=100, null=True)
Expand Down