techmatters / terraso-web-client

A React project that powers the frontend of Terraso platform.
https://app.terraso.org/
GNU Affero General Public License v3.0
11 stars 3 forks source link

Engineering task - Generate Sample JSON file #1029

Closed DerekCaelin closed 1 year ago

DerekCaelin commented 1 year ago

Create a sample JSON file of a Landscape Profile for LandScale team to review.

Derek:

We are attracted to the idea of users simply copying the URL to their Terraso landscape: (eg: http://app.terraso.org/landscapes/mount-kenya/ ) and pasting it somewhere in LandScale. LandScale would then go and fetch a JSON file with profile information, (Terraso would detect if it was LandScale making the query and provide a response.)

Our current thinking for next steps is to generate a sample JSON file with a sample landscape profile for your team to examine and provide feedback on.

Edita:

I like the suggested path for this work. Please send over the JSON file.

### Tasks
- [x] Generate sample schema
- [x] Generate sample for Sacred Sierra
- [ ] Revise based of Edita feedback
shrouxm commented 1 year ago

schema:

{
  "id": string,
  "name": string,
  "description": string,
  "region": string (country code?),
  "contact_email": string (email),
  "website": string (url),
  "boundary": geojson
}

i'm not sure what other information should be included, can you provide any guidance @DerekCaelin ?

DerekCaelin commented 1 year ago

Hi @shrouxm, please also include:

All this data will be imported to LandScale landscapes as a part of their landscape creation process.

Image

DerekCaelin commented 1 year ago

@shrouxm did this answer the question?

shrouxm commented 1 year ago

@DerekCaelin yes, it has raised more questions! i keep getting distracted before i can capture them all at once, here is what i can think of now & i will try to make sure it's comprehensive by EOD:

DerekCaelin commented 1 year ago

the landscape boundary i was thinking to include inline rather than as a URL as it is small and already in JSON format (this is also how it's delivered to our own web frontend)

That sounds dandy - we can get feedback from the LandScale engineers if that works.

some fields are (i think) stored in a standardized format on the backend, like country or language code, and then rendered into the user's language dynamically. should i include the country/language code, english translation, all translations?

It looks like LandScale has both an English and Spanish interface. I would guess that we include the country code and language code.

some fields are internationalized but there wouldn't be a standardized format for them (e.g. livelihoods, ecosystem). should i include the english translation or all translations?

All translations, please.

For all of these, I'd expect to get feedback from the LandScale engineers on whether this works for them once they review the sample file.

shrouxm commented 1 year ago

@DerekCaelin here is an updated schema! it is basically one to one how the data is sent to our own web app.

{
  "id": string,
  "name": string,
  "description": string,
  "region": string (ISO country code),
  "contact_email": string (email),
  "website": string (url),
  "areaPolygon": geojson,
  "areaTypes": [string],
  "areaScalarHa": number,
  "population": number,
  "profileImage": string (url),
  "profileImageDescription": string,
  "taxonomyTerms": [{
    "type": "ECOSYSTEM_TYPE" | "LIVELIHOOD" | "COMMODITY" | "ORGANIZATION" | "LANGUAGE",
    "valueOriginal": string (ISO language code for languages),
    "valueEn": string,
    "valueEs": string
  }],
  "associatedGroups": [string],
  "developmentStrategy": {
    "objectives": string,
    "problemSituation": string,
    "interventionStrategy": string
  }
}
DerekCaelin commented 1 year ago

Perfect. I will transmit this to the LandScale team for feedback.

shrouxm commented 1 year ago

@DerekCaelin here is one with sample values filled in. in filling in the sample values i made a slight tweak to the schema so that is also edited

{
  "id": "89baf52e-46c3-4e3c-a540-e7e9b7d208c3",
  "name": "Sacred Sierra",
  "description": "Colombia’s Sacred Sierra landscape unites the Sierra Nevada de Santa Marta and the Serranía del Perijá mountain ranges along the country’s northern Caribbean coast. Declared by UNESCO as a Biosphere Reserve in 1979, this region contains diverse and distinct ecological zones —from wetlands and mangroves to tropical rainforests, deserts and alpine tundra. The region’s 50,000 residents represent four Indigenous communities, all direct descendants of the ancient Tayrona culture and all dependent on the surrounding natural resources for their livelihoods.",
  "region": "CO",
  "contact_email": "info@anei.org.co",
  "website": "https://www.anei.org.co/",
  "areaPolygon": {"bbox": [-76.38244628906251, 9.784851250750604, -70.24108886718751, 11.942601073545658], "type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[-74.158946, 11.323941], [-74.152634, 11.324417], [-74.144865, 11.336318], [-74.13564, 11.316323], [-74.129814, 11.316561], [-74.126658, 11.324893], [-74.125201, 11.332986], [-74.106508, 11.318704], [-74.103595, 11.32275], [-74.106751, 11.330844], [-74.112092, 11.343697], [-74.106751, 11.347268], [-74.096555, 11.331796], [-74.097283, 11.320608], [-74.078105, 11.317752], [-74.078105, 11.336318], [-74.067423, 11.343459], [-74.05577, 11.328225], [-74.005275, 11.341555], [-73.745728, 11.24845], [-73.328247, 11.280774], [-72.990417, 11.509631], [-72.809143, 11.649546], [-72.718506, 11.703341], [-72.600389, 11.731504], [-72.577084, 11.682059], [-72.612042, 11.598363], [-72.538241, 11.571727], [-72.507167, 11.518448], [-72.413945, 11.50703], [-72.390639, 11.453738], [-72.421713, 11.251901], [-72.773438, 11.05443], [-73.061829, 10.822515], [-73.212891, 10.622817], [-73.270569, 10.490513], [-73.471069, 10.290599], [-73.723755, 10.120302], [-73.932495, 10.00131], [-73.996778, 10.209485], [-74.018142, 10.396745], [-74.091942, 10.543799], [-74.080811, 10.757763], [-74.212646, 11.038255], [-74.22255, 11.096523], [-74.232747, 11.117486], [-74.228862, 11.152739], [-74.237602, 11.181796], [-74.227891, 11.205134], [-74.237602, 11.216088], [-74.218666, 11.237281], [-74.21721, 11.252996], [-74.193419, 11.266091], [-74.206285, 11.27371], [-74.188321, 11.302278], [-74.14705, 11.301326], [-74.158946, 11.323941]]]}, "properties": {}}]},
  "areaTypes": ["rural"],
  "areaScalarHa": 1710279.576,
  "population": null,
  "profileImage": "https://images.terraso.org/89baf52e-46c3-4e3c-a540-e7e9b7d208c3/profile-image",
  "profileImageDescription": "A group of ANEI cooperatives sitting and speaking within the landscape.",
  "taxonomyTerms": [
    {
        "type": "ECOSYSTEM_TYPE",
        "valueOriginal": "Forest, Tropical",
        "valueEn": "",
        "valueEs": "Bosque, Tropical"
    },
    {
        "type": "LIVELIHOOD",
        "valueOriginal": "Crop farming",
        "valueEn": "",
        "valueEs": "Cultivos agrícolas"
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Cassava",
        "valueEn": "",
        "valueEs": "Mandioca/Yuca"
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Coffee",
        "valueEn": "",
        "valueEs": "Café"
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Cocoa",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Sugarcane",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Corn",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Beans",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Plantains",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Chickens",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Pigs",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Cows",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "COMMODITY",
        "valueOriginal": "Goats",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "ORGANIZATION",
        "valueOriginal": "Ethos Agriculture",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "ORGANIZATION",
        "valueOriginal": "ANEI Cooperative",
        "valueEn": "",
        "valueEs": ""
    },
    {
        "type": "AGRICULTURAL_PRODUCTION_METHOD",
        "valueOriginal": "Agroforestry",
        "valueEn": "Agroforestry",
        "valueEs": "Agroforestal"
    },
    {
        "type": "LANGUAGE",
        "valueOriginal": "spa",
        "valueEn": "Spanish",
        "valueEs": "Español"
    },
    {
        "type": "LANGUAGE",
        "valueOriginal": "vmq",
        "valueEn": "Soyaltepec Mixtec",
        "valueEs": "Soyaltepec Mixtec"
    }
  ],
  "associatedGroups": ["Native Agroecological Producers and Farmers organization (ANEI)"],
  "developmentStrategy": {
    "objectives": "Since 1995, the Native Agroecological Producers and Farmers (ANEI) organization has convened a Landscape Partnership that protects the area’s unique ecological diversity while ensuring a sustainable future for local people. Focused on the organic production of high-quality coffee, ANEI and its partners have implemented holistic, sustainable projects that strengthen collaborative efforts to reclaim social, economic and cultural rights while promoting food security and offering healthy products to the world.",
    "problemSituation": "Despite its protected status and the efforts of the Landscape Partnership, the Sacred Sierra still faces high deforestation rates and environmental degradation from cattle grazing, mass tourism, mining and dam construction. The increasing impact of climate change also poses a high risk to the livelihoods of communities and the region’s biodiversity. Meanwhile, limited access to social services such as health, education, basic sanitation, potable water and electricity places additional burdens on the local communities, contributing to unsustainable resource extraction.",
    "interventionStrategy": "ANEI was created to promote and preserve agricultural practices from the Arhuaca cosmovision, which respects Mother Earth as the origin of all things. This worldview leads Sacred Sierra’s people to hold awareness for their own and neighboring communities in order to promote sustainable, organic and environmentally friendly farming practices.The Sacred Sierra Landscape Partnership is well on its way to tackling many of the challenges the region faces. With support from 1000 Landscapes for 1 Billion People, the partnership has developed a common understanding of the landscape’s challenges and opportunities. This work is helping it establish a shared vision for achieving a balance between trade, environmental preservation and economic and social development for local communities. Partners have drafted a collaborative action plan that includes programs rooted in traditional ecological knowledge that supports local ownership, promotes regenerative agriculture and aids rural development."
  }
}
DerekCaelin commented 1 year ago

Feedback from Edita

Hey Derek,

Hope you’re well! I’m finalizing the changes to our profile and have tried to put together the requirements for the export/import of profiles. As I said, we’ll be ready to implement this during the summer. We will have both the download/export and the upload/import options. I have a few questions for you:

Countries – just to confirm, you’re using Alpha-2-codes from https://www.iso.org/obp/ui. Is that right? Sharing contact details – I’m weary of adding this information to the exported file. Is it OK to leave it out? On your taxonomy terms, what’s the difference between the Original and English terms? We only collect information in English, so I’d fill in just the English one. Does that work or best to only fill in the original one? Also, should this be a list of strings instead of just a string? We do not use ‘languages’, but I noticed your proposed JSON has two different fields for them – what’s the difference? (standalone ‘languages’ and taxonomy terms). I’ve added all the other profile information we use

The JSON file would take the following format (I’ve added ‘comments’ in blue) with added fields to represent LandScale’s profiles info, and I built onto the one you previously shared with me:

{ "id": string, #database ID of the landscape. Ideally, unique universally. "name": string, #landscape name

"contact_email": string (email), #email address from contact information "website": string (url), #website from contact information "description": string, #landscape description "region": string (ISO country code), #Country, need to convert to ISO, see https://www.iso.org/obp/ui

“municipalities”: [string], #list of municipalities inside the boundary

“recognizedEcologicalPoliticalUnit”: Boolean, #Whether or not this landscape is operating at the scale of a recognized ecological or political unit "boundary": geojson, #The landscape boundary file. "languages": [string (ISO language code)], "areaTypes": [string], #This is rural/urban. "areaScalarHa": number, #Landscape size in hectares "population": number, #Landscape population "profileImage": string (url), #First image, URL to it hosted in LandScale "profileImageDescription": string, # First image description "taxonomyTerms": [{

This is extra information available.

"type": "ECOSYSTEM_TYPE" | "LIVELIHOOD" | "COMMODITY" | "ORGANIZATION" | "LANGUAGE" | "LAND_COVER",

Ecosystem type – LandScale does not have this information.

Livelihood – list (LandScale first level) economic activities.

Commodity – list all traded commodities

Organization – list owner (and co-owner if it exists) organization(s) name(s).

Language – LandScale does not have this information

Land Cover – Land Cover (LandScale second level) categories "valueOriginal": string (ISO language code for languages), # LandScale does not use "valueEn": string, #enter value here "valueEs": string # LandScale does not use }], "associatedGroups": [string], #LandScale does not have this information "developmentStrategy": { "objectives": string, #Landscape Initiative Objectives "problemSituation": string, #Main landscape sustainability challenges and opportunities "interventionStrategy": string #LandScale does not have this information },

“demographics”: [{ #Population breakdowns by domicile (rural/urban), ethnicity, gender and age, if available. All given in numbers OR percentage.

“type”: “DOMICILE” | “ETHNIC_INDIGENOUS_GROUPS” | “GENDER” | “AGE”,

“unit”: “number” | “percentage”,

“breakdown”: [{

“name”: string,

“number”: number,

}],

}],

“organizationsInvolved”: {

“stakeholders”: [string], #list of organizations

“partners”: [string], #list of organizations

}

}

DerekCaelin commented 1 year ago

Edita's comments:

Hey Derek,

Hope you’re well! I’m finalizing the changes to our profile and have tried to put together the requirements for the export/import of profiles. As I said, we’ll be ready to implement this during the summer. We will have both the download/export and the upload/import options. I have a few questions for you:

Countries – just to confirm, you’re using Alpha-2-codes from https://www.iso.org/obp/ui. Is that right? Sharing contact details – I’m weary of adding this information to the exported file. Is it OK to leave it out? On your taxonomy terms, what’s the difference between the Original and English terms? We only collect information in English, so I’d fill in just the English one. Does that work or best to only fill in the original one? Also, should this be a list of strings instead of just a string? We do not use ‘languages’, but I noticed your proposed JSON has two different fields for them – what’s the difference? (standalone ‘languages’ and taxonomy terms). I’ve added all the other profile information we use

The JSON file would take the following format (I’ve added ‘comments’ in blue) with added fields to represent LandScale’s profiles info, and I built onto the one you previously shared with me:

{ "id": string, #database ID of the landscape. Ideally, unique universally. "name": string, #landscape name

"contact_email": string (email), #email address from contact information "website": string (url), #website from contact information "description": string, #landscape description "region": string (ISO country code), #Country, need to convert to ISO, see https://www.iso.org/obp/ui

“municipalities”: [string], #list of municipalities inside the boundary

“recognizedEcologicalPoliticalUnit”: Boolean, #Whether or not this landscape is operating at the scale of a recognized ecological or political unit "boundary": geojson, #The landscape boundary file. "languages": [string (ISO language code)], "areaTypes": [string], #This is rural/urban. "areaScalarHa": number, #Landscape size in hectares "population": number, #Landscape population "profileImage": string (url), #First image, URL to it hosted in LandScale "profileImageDescription": string, # First image description "taxonomyTerms": [{

This is extra information available.

"type": "ECOSYSTEM_TYPE" | "LIVELIHOOD" | "COMMODITY" | "ORGANIZATION" | "LANGUAGE" | "LAND_COVER",

Ecosystem type – LandScale does not have this information.

Livelihood – list (LandScale first level) economic activities.

Commodity – list all traded commodities

Organization – list owner (and co-owner if it exists) organization(s) name(s).

Language – LandScale does not have this information

Land Cover – Land Cover (LandScale second level) categories "valueOriginal": string (ISO language code for languages), # LandScale does not use "valueEn": string, #enter value here "valueEs": string # LandScale does not use }], "associatedGroups": [string], #LandScale does not have this information "developmentStrategy": { "objectives": string, #Landscape Initiative Objectives "problemSituation": string, #Main landscape sustainability challenges and opportunities "interventionStrategy": string #LandScale does not have this information },

“demographics”: [{ #Population breakdowns by domicile (rural/urban), ethnicity, gender and age, if available. All given in numbers OR percentage.

“type”: “DOMICILE” | “ETHNIC_INDIGENOUS_GROUPS” | “GENDER” | “AGE”,

“unit”: “number” | “percentage”,

“breakdown”: [{

“name”: string,

“number”: number,

}],

}],

“organizationsInvolved”: {

“stakeholders”: [string], #list of organizations

“partners”: [string], #list of organizations

}

}

Tech Matters Mail - JSON download of profiles (1).pdf

paulschreiber commented 1 year ago

I would adjust the schema for language strings and make value a hash:

    {
        "type": "AGRICULTURAL_PRODUCTION_METHOD",
        "valueOriginal": "Agroforestry",
        "valueEn": "Agroforestry",
        "valueEs": "Agroforestal"
    },
    {
        "type": "AGRICULTURAL_PRODUCTION_METHOD",
        "value": {
            "original": "Agroforestry",
            "en": "Agroforestry",
            "es": "Agroforestal"
        }
    },