Implementing solution based on Freemarker

This commit is contained in:
Luca Frosini 2023-04-11 18:35:29 +02:00
parent a4f5143647
commit 6fc93597f4
2 changed files with 110 additions and 33 deletions

View File

@ -2,6 +2,41 @@
"title" : "${stock_name}",
"license_id": "${license_id}",
"description": "Short Name: ${short_name}\nGRSF Semantic Identifier: ${grsf_semantic_identifier}\nRecord URL: ${uri_resolver_base_url}/${grsf_uuid}",
"groups": [
<#if abundance_level??>
{
"name": "abundance-level-group"
},
</#if>
<#if firms_standard_abundance_level??>
{
"name": "abundance-level-firms-standard-group"
},
</#if>
<#if assessment_methods??>
{
"name": "assessment-method-group"
},
</#if>
<#if biomass??>
{
"name": "biomass-group"
},
</#if>
<#if catches??>
{
"name": "catch-group"
},
</#if>
{
"name": "stock-group"
}
],
"tags" : [
<#if assessment_area??>
<#list assessment_area as aa>
@ -28,6 +63,23 @@
}
],
"extras": [
{
"key": "stock_identity:GRSF Stock Name",
"value": "${stock_name}"
},
{
"key": "stock_identity:Short Name",
"value": "${short_name}"
},
{
"key": "stock_identity:GRSF Semantic Identifier",
"value": "${grsf_semantic_identifier}"
},
{
"key": "stock_identity:GRSF Type",
"value": "${grsf_type?capitalize}"
},
<#if assessment_area??>
<#list assessment_area as aa>
{
@ -73,49 +125,75 @@
</#list>
</#if>
<#if abundance_level?? && include_sensitive>
<#list abundance_level[0..*5] as al>
<#list abundance_level[0..*5] as ts>
{
"key": "stock_data:Abundance Level",
"value" "${al.value} [<#if al.unit?has_content>Unit: ${al.unit} - </#if><#if al.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${al.reporting_year_or_assessment_id} - </#if><#if al.reference_year?has_content>Ref. Year: ${al.reference_year} - </#if><#if al.data_owner?has_content>Data Owner: ${al.data_owner} - </#if><#if al.db_source?has_content>DB Source: ${al.db_source}</#if>]"
"value" "${ts.value} [<#if ts.unit?has_content>Unit: ${ts.unit} - </#if><#if ts.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${ts.reporting_year_or_assessment_id} - </#if><#if ts.reference_year?has_content>Ref. Year: ${ts.reference_year} - </#if><#if ts.data_owner?has_content>Data Owner: ${ts.data_owner} - </#if><#if ts.db_source?has_content>DB Source: ${ts.db_source}</#if>]"
},
</#list>
</#if>
<#if firms_standard_abundance_level?? && include_sensitive>
<#list firms_standard_abundance_level[0..*5] as ts>
{
"key": "stock_identity:GRSF Stock Name",
"value": "${stock_name}"
},
{
"key": "stock_identity:Short Name",
"value": "${short_name}"
},
{
"key": "stock_identity:GRSF Semantic Identifier",
"value": "${grsf_semantic_identifier}"
},
{
"key": "stock_identity:GRSF Type",
"value": "${grsf_type?capitalize}"
"key": "stock_data:Abundance Level (FIRMS Standard)",
"value" "${ts.value} [<#if ts.unit?has_content>Unit: ${ts.unit} - </#if><#if ts.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${ts.reporting_year_or_assessment_id} - </#if><#if ts.reference_year?has_content>Ref. Year: ${ts.reference_year} - </#if><#if ts.data_owner?has_content>Data Owner: ${ts.data_owner} - </#if><#if ts.db_source?has_content>DB Source: ${ts.db_source}</#if>]"
},
</#list>
</#if>
<#if assessment_methods?? && include_sensitive>
<#list assessment_methods as am>
{
"key": "system:type",
"value": "${grsf_type?capitalize}"
"key": "stock_data:Assessment Method",
"value" "${am}"
},
</#list>
</#if>
<#if assessor?? && include_sensitive>
{
"key": "stock_data:Assessor",
"value" "${assessor}"
},
</#if>
<#if biomass?? && include_sensitive>
<#list biomass[0..*5] as ts>
{
"key": "stock_data:Biomass",
"value" "${ts.value} [<#if ts.unit?has_content>Unit: ${ts.unit} - </#if><#if ts.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${ts.reporting_year_or_assessment_id} - </#if><#if ts.reference_year?has_content>Ref. Year: ${ts.reference_year} - </#if><#if ts.data_owner?has_content>Data Owner: ${ts.data_owner} - </#if><#if ts.db_source?has_content>DB Source: ${ts.db_source}</#if>]"
},
</#list>
</#if>
<#if catches?? && include_sensitive>
<#list catches[0..*5] as ts>
{
"key": "stock_data:Catch",
"value" "${ts.value} [<#if ts.unit?has_content>Unit: ${ts.unit} - </#if><#if ts.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${ts.reporting_year_or_assessment_id} - </#if><#if ts.reference_year?has_content>Ref. Year: ${ts.reference_year} - </#if><#if ts.data_owner?has_content>Data Owner: ${ts.data_owner} - </#if><#if ts.db_source?has_content>DB Source: ${ts.db_source}</#if>]"
},
</#list>
</#if>
<#if data_owner?? && include_sensitive>
<#list data_owner as do>
{
"key": "stock_data:Data Owner",
"value" "${do}"
},
</#list>
</#if>
{
"key": "Record URL",
"value": "${uri_resolver_base_url}/${grsf_uuid}"
}
},
{
"key": "system:type",
"value": "${grsf_type?capitalize}"
}
]
}

View File

@ -11,8 +11,7 @@
}
]
},
"fields": [
]
"timeseries": ["abundance_level", "firms_standard_abundance_level", "biomass"],
"resources": ["assessment_methods"]
}