Skip to content

Commit

Permalink
✨ Update json schema contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
LePetitTim committed Aug 4, 2023
1 parent 840086a commit 62bbaa4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
38 changes: 19 additions & 19 deletions georiviere/contribution/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_landing(choices, meta):
'landing_type':
{
'type': "string",
'title': meta.get_field('landing_type').verbose_name.title(),
'title': str(meta.get_field('landing_type').verbose_name.capitalize()),
'enum': list(LandingType.objects.values_list('label', flat=True))
}
},
Expand All @@ -90,7 +90,7 @@ def get_excessive_cutting_riparian_forest(choices, meta):
{
'type': "number",
'title': str(meta.get_field(
'excessive_cutting_length').verbose_name.title()),
'excessive_cutting_length').verbose_name.capitalize()),
}
},
}
Expand All @@ -111,7 +111,7 @@ def get_disruptive_jam(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'jam_type').verbose_name.title()),
'jam_type').verbose_name.capitalize()),
}
},
}
Expand All @@ -132,7 +132,7 @@ def get_bank_erosion(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'length_bank_erosion').verbose_name.title()),
'length_bank_erosion').verbose_name.capitalize()),
}
},
}
Expand All @@ -153,7 +153,7 @@ def get_river_bed_incision(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'bank_height').verbose_name.title()),
'bank_height').verbose_name.capitalize()),
}
},
}
Expand All @@ -174,7 +174,7 @@ def get_fish_diseases(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'disease_type').verbose_name.title()),
'disease_type').verbose_name.capitalize()),
'enum': list(DiseaseType.objects.values_list('label', flat=True))
}
},
Expand All @@ -189,14 +189,14 @@ def get_fish_mortality(choices, meta):
{
'type': "number",
'title': str(meta.get_field(
'number_death').verbose_name.title())
'number_death').verbose_name.capitalize())
},
}
if DeadSpecies.objects.exists():
fish_mortality_property['dead_species'] = {
'type': "string",
'title': str(meta.get_field(
'dead_species').verbose_name.title()),
'dead_species').verbose_name.capitalize()),
'enum': list(DeadSpecies.objects.values_list('label', flat=True))
}
fish_mortality = {
Expand Down Expand Up @@ -258,14 +258,14 @@ def get_invasive_species(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'home_area').verbose_name.title())
'home_area').verbose_name.capitalize())
},
}
if InvasiveSpecies.objects.exists():
invasive_species_property['invasive_species'] = {
'type': "string",
'title': str(meta.get_field(
'invasive_species').verbose_name.title()),
'invasive_species').verbose_name.capitalize()),
'enum': list(InvasiveSpecies.objects.values_list('label', flat=True))
}
invasive_species = {
Expand All @@ -287,21 +287,21 @@ def get_heritage_species(choices, meta):
{
'type': "number",
'title': str(meta.get_field(
'number_heritage_species').verbose_name.title())
'number_heritage_species').verbose_name.capitalize())
},
}
if HeritageSpecies.objects.exists():
heritage_species_property['heritage_species'] = {
'type': "string",
'title': str(meta.get_field(
'heritage_species').verbose_name.title()),
'heritage_species').verbose_name.capitalize()),
'enum': list(HeritageSpecies.objects.values_list('label', flat=True))
}
if HeritageObservation.objects.exists():
heritage_species_property['heritage_observation'] = {
'type': "string",
'title': str(meta.get_field(
'heritage_observation').verbose_name.title()),
'heritage_observation').verbose_name.capitalize()),
'enum': list(HeritageObservation.objects.values_list('label', flat=True))
}
heritage_species = {
Expand All @@ -323,14 +323,14 @@ def get_fish_species(choices, meta):
{
'type': "number",
'title': str(meta.get_field(
'number_fish_species').verbose_name.title())
'number_fish_species').verbose_name.capitalize())
},
}
if FishSpecies.objects.exists():
fish_species_property['fish_species'] = {
'type': "string",
'title': str(meta.get_field(
'fish_species').verbose_name.title()),
'fish_species').verbose_name.capitalize()),
'enum': list(FishSpecies.objects.values_list('label', flat=True))
}
fish_species = {
Expand Down Expand Up @@ -388,7 +388,7 @@ def get_overflow(choices, meta):
{
'type': "string",
'title': str(meta.get_field(
'landmark').verbose_name.title())
'landmark').verbose_name.capitalize())
},
}
}
Expand All @@ -408,7 +408,7 @@ def get_quantity_condition():
'properties': {
'type': {
'type': "string",
'title': str(meta_quantity.get_field('type').verbose_name.title()),
'title': str(meta_quantity.get_field('type').verbose_name.capitalize()),
'enum': list(quantity_choices.labels)
}
},
Expand All @@ -429,14 +429,14 @@ def get_pollution(choices, meta):
pollution_property['nature_pollution'] = {
'type': "string",
'title': str(meta.get_field(
'nature_pollution').verbose_name.title()),
'nature_pollution').verbose_name.capitalize()),
'enum': list(NaturePollution.objects.values_list('label', flat=True))
}
if TypePollution.objects.exists():
pollution_property['type_pollution'] = {
'type': "string",
'title': str(meta.get_field(
'type_pollution').verbose_name.title()),
'type_pollution').verbose_name.capitalize()),
'enum': list(TypePollution.objects.values_list('label', flat=True))
}
pollution = {
Expand Down
36 changes: 18 additions & 18 deletions georiviere/portal/tests/data/json_schema_base_contribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"properties": {
"excessive_cutting_length": {
"type": "number",
"title": "Excessive Cutting Length In Meters"
"title": "Excessive cutting length (in meters)"
}
}
}
Expand All @@ -112,7 +112,7 @@
"properties": {
"length_bank_erosion": {
"type": "string",
"title": "Length Bank Erosion"
"title": "Length bank erosion (in meters)"
}
}
}
Expand All @@ -129,7 +129,7 @@
"properties": {
"bank_height": {
"type": "string",
"title": "Bank Height"
"title": "Bank height (in meters)"
}
}
}
Expand All @@ -146,11 +146,11 @@
"properties": {
"number_death": {
"type": "number",
"title": "Number Death"
"title": "Number death"
},
"dead_species": {
"type": "string",
"title": "Dead Species",
"title": "Dead species",
"enum": [
"Dead species 0",
"Dead species 1",
Expand All @@ -172,7 +172,7 @@
"properties": {
"landing_type": {
"type": "string",
"title": "Landing Type",
"title": "Landing type",
"enum": [
"Landing type 0",
"Landing type 1",
Expand All @@ -194,7 +194,7 @@
"properties": {
"jam_type": {
"type": "string",
"title": "Jam Type"
"title": "Jam type"
}
}
}
Expand All @@ -211,7 +211,7 @@
"properties": {
"disease_type": {
"type": "string",
"title": "Disease Type",
"title": "Disease type",
"enum": [
"Disease type 0",
"Disease type 1",
Expand Down Expand Up @@ -258,11 +258,11 @@
"properties": {
"home_area": {
"type": "string",
"title": "Home Area"
"title": "Home area (in square meters)"
},
"invasive_species": {
"type": "string",
"title": "Invasive Species",
"title": "Invasive species",
"enum": [
"Invasive species 0",
"Invasive species 1",
Expand All @@ -284,11 +284,11 @@
"properties": {
"number_heritage_species": {
"type": "number",
"title": "Number Heritage Species"
"title": "Number heritage species"
},
"heritage_species": {
"type": "string",
"title": "Heritage Species",
"title": "Heritage species",
"enum": [
"Heritage species 0",
"Heritage species 1",
Expand All @@ -297,7 +297,7 @@
},
"heritage_observation": {
"type": "string",
"title": "Heritage Observation",
"title": "Heritage observation",
"enum": [
"Heritage observation 0",
"Heritage observation 1",
Expand All @@ -319,11 +319,11 @@
"properties": {
"number_fish_species": {
"type": "number",
"title": "Number Fish Species"
"title": "Number fish species"
},
"fish_species": {
"type": "string",
"title": "Fish Species",
"title": "Fish species",
"enum": [
"Fish species 0",
"Fish species 1",
Expand All @@ -345,7 +345,7 @@
"properties": {
"type": {
"type": "string",
"title": "Water Level Type",
"title": "Water level type",
"enum": [
"Dry",
"In the process of drying out",
Expand Down Expand Up @@ -412,7 +412,7 @@
"properties": {
"nature_pollution": {
"type": "string",
"title": "Nature Pollution",
"title": "Nature pollution",
"enum": [
"Nature pollution 0",
"Nature pollution 1",
Expand All @@ -421,7 +421,7 @@
},
"type_pollution": {
"type": "string",
"title": "Type Pollution",
"title": "Type pollution",
"enum": [
"Type pollution 0",
"Type pollution 1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"properties": {
"excessive_cutting_length": {
"type": "number",
"title": "Excessive Cutting Length In Meters"
"title": "Excessive cutting length (in meters)"
}
}
}
Expand All @@ -103,7 +103,7 @@
"properties": {
"length_bank_erosion": {
"type": "string",
"title": "Length Bank Erosion"
"title": "Length bank erosion (in meters)"
}
}
}
Expand All @@ -120,7 +120,7 @@
"properties": {
"bank_height": {
"type": "string",
"title": "Bank Height"
"title": "Bank height (in meters)"
}
}
}
Expand All @@ -137,7 +137,7 @@
"properties": {
"number_death": {
"type": "number",
"title": "Number Death"
"title": "Number death"
}
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@
"properties": {
"home_area": {
"type": "string",
"title": "Home Area"
"title": "Home area (in square meters)"
}
}
}
Expand All @@ -196,7 +196,7 @@
"properties": {
"number_heritage_species": {
"type": "number",
"title": "Number Heritage Species"
"title": "Number heritage species"
}
}
}
Expand All @@ -213,7 +213,7 @@
"properties": {
"number_fish_species": {
"type": "number",
"title": "Number Fish Species"
"title": "Number fish species"
}
}
}
Expand All @@ -230,7 +230,7 @@
"properties": {
"type": {
"type": "string",
"title": "Water Level Type",
"title": "Water level type",
"enum": [
"Dry",
"In the process of drying out",
Expand Down

0 comments on commit 62bbaa4

Please sign in to comment.