Skip to content

Commit

Permalink
Merge pull request #342 from gaiaresources/BDRSPS-1048
Browse files Browse the repository at this point in the history
BDRSPS-1048 Add extra fields mapping for site visit template
  • Loading branch information
joecrowleygaia authored Nov 20, 2024
2 parents be28437 + f651af2 commit be4341d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions abis_mapping/templates/survey_site_visit_data_v2/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ def apply_mapping(
data=data,
full_schema=True,
)
extra_schema = self.extra_fields_schema(
data=data,
full_schema=False,
)

# Construct Resource
resource = frictionless.Resource(
Expand Down Expand Up @@ -273,6 +277,7 @@ def apply_mapping(
row=row,
dataset=dataset_iri,
graph=graph,
extra_schema=extra_schema,
base_iri=base_iri,
)
graph_has_data = True
Expand All @@ -295,6 +300,7 @@ def apply_mapping_row(
row: frictionless.Row,
dataset: rdflib.URIRef,
graph: rdflib.Graph,
extra_schema: frictionless.Schema,
base_iri: rdflib.Namespace | None,
) -> None:
"""Applies mapping for a row in the Survey Site Visit Data template.
Expand All @@ -303,6 +309,7 @@ def apply_mapping_row(
row: Row to be processed in the dataset.
dataset: Dataset IRI this row is a part of.
graph: Graph to map row into.
extra_schema: Schema of extra fields.
base_iri: Optional base IRI to use for mapping.
"""
# variables starting with row_ are values from the row.
Expand Down Expand Up @@ -535,6 +542,14 @@ def apply_mapping_row(
graph=graph,
)

# Add extra fields
self.add_extra_fields_json(
subject_uri=uri_site_visit_activity,
row=row,
graph=graph,
extra_schema=extra_schema,
)

def add_site_visit_activity(
self,
*,
Expand Down

0 comments on commit be4341d

Please sign in to comment.