Skip to content

Commit

Permalink
Merge pull request #571 from NASA-IMPACT/issue-561/glossary-work
Browse files Browse the repository at this point in the history
Issue 561/glossary work
  • Loading branch information
edkeeble authored Sep 7, 2023
2 parents c65324c + 60769fe commit 899646b
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 9 deletions.
9 changes: 8 additions & 1 deletion src/content/faq.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@
{
"section": "2 Inventory Content/What’s New",
"question": "What are Geophysical Concepts?",
"answer": "Geophysical concepts are terms that correlate to the six NASA Earth Science Focus Areas and the Global Change Master Directory (GCMD) Earth Science Keywords, bridging the gap between the general and specific terms used to describe scientific studies and data. {{concepts}}",
"answer": "{{link.geophysicalconcepts}} are terms that correlate to the six NASA Earth Science Focus Areas and the Global Change Master Directory (GCMD) Earth Science Keywords, bridging the gap between the general and specific terms used to describe scientific studies and data. {{concepts}}",
"images": [
{
"id": "concepts",
"alt": "Relationship between geophysical concepts, NASA Earth Science Focus Areas, and GCMD Earth Science Keywords"
}
],
"links": [
{
"id": "link.geophysicalconcepts",
"text": "Geophysical concepts",
"url": "https://drive.google.com/file/d/1YvQ6iR5S_ehJ4cTP87q6Y7odQ8oW5gg0/view?usp=drive_link"
}
]
},
{
Expand Down
13 changes: 10 additions & 3 deletions src/content/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
{
"term": "Instrument Package",
"definition": "All instruments operating on a platform. This may consist of a single instrument or multiple individual instruments and any associated technology such as power systems or telecommunications hardware. The instrument package used on a given platform can change over time, by flight, deployment, or field investigation, in order to support specific science/research objectives or due to an individual instrument failure.",
"definition": "All instruments operating on a platform. This may consist of a single instrument or multiple individual instruments and any associated technology such as power systems or telecommunications hardware. The instrument package used on a given platform can change over time, by flight, deployment, or field investigation, in order to support specific science/research objectives or due to an individual instrument failure.",
"note": "Note that individuals, science teams, or research groups may also refer to the instrument package as the instrument payload, particularly for airborne platforms."
},
{
Expand Down Expand Up @@ -64,10 +64,17 @@
},
{
"term": "Geophysical Concept",
"definition": "High-level science concepts identified by ADMG as a means to bridge the necessary generality of NASA’s Earth Science Focus Areas and the inherent specificity of the GCMD Science Keywords. These intermediary concepts are intended to facilitate improved communication and contextual use of both the NASA Earth Science Focus Areas and the GCMD Earth Science Keywords, bearing in mind the many-to-many relationships among them and the fundamental interconnectedness of the various processes that comprise the Earth system. There are currently 26 ADMG-identified geophysical concepts which can be assigned as metadata in CASEI to categorize a field investigation with respect to its purpose, goals, effort, or findings."
"definition": "High-level science concepts identified by ADMG as a means to bridge the necessary generality of NASA’s Earth Science Focus Areas and the inherent specificity of the GCMD Science Keywords. These intermediary concepts are intended to facilitate improved communication and contextual use of both the NASA Earth Science Focus Areas and the GCMD Earth Science Keywords, bearing in mind the many-to-many relationships among them and the fundamental interconnectedness of the various processes that comprise the Earth system. There are currently 26 {{link.geophysicaldoc}} which can be assigned as metadata in CASEI to categorize a field investigation with respect to its purpose, goals, effort, or findings.",
"links": [
{
"id": "link.geophysicaldoc",
"text": "ADMG-identified geophysical concepts",
"url": "https://drive.google.com/file/d/1YvQ6iR5S_ehJ4cTP87q6Y7odQ8oW5gg0/view?usp=drive_link"
}
]
},
{
"term": "Assigned DAAC",
"definition": "The DAAC designated by NASA's Earth Science Data Systems (ESDS) Program to have the responsibility of ensuring proper stewardship of the data and information for an investigation or facility instrument/major airborne instrument. Until recently, formal DAAC assignments were not often completed. Therefore, for older field investigations with data products already within the EOSDIS system, the DAAC that distributes the majority of the data is considered, by default, the assigned DAAC. If data products from a field investigation are archived and distributed by separate DAACs, it is the responsibility of the assigned DAAC to organize all information, clearly identify all data products, provide additional metadata and information links, and obtain a data product group DOI to represent all the data products resulting from an investigation, as needed. The assigned DAAC must maintain all links and preserve all materials needed to fully understand the data products and the campaign context in the future. For historical data not yet available in EOSDIS and the Common Metadata Repository (CMR), a DAAC-assignment procedure is followed to assign the historical field investigation to a DAAC for data publication."
}
]
]
63 changes: 61 additions & 2 deletions src/pages/glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from "prop-types"
import { graphql } from "gatsby"
import { GatsbyImage } from "gatsby-plugin-image"
import VisuallyHidden from "@reach/visually-hidden"

import Layout, {
PageBody,
SectionHeader,
Expand Down Expand Up @@ -253,7 +252,9 @@ export default function Glossary({ data }) {
slimPadding
>
<h3>{x.term}</h3>
<p>{x.definition}</p>
<div>
{x.links ? <LinkSection node={x} /> : x.definition}
</div>
{x.note && (
<p
data-cy="glossary-definition-note"
Expand All @@ -275,13 +276,64 @@ export default function Glossary({ data }) {
)
}

const LinkSection = ({ node }) => {
const templatePattern = /{{\s?([^{}\s]*)\s?}}/g
// split definition text by the template pattern
const parts = node.definition.split(templatePattern)
// map over parts and perform replacement
return (
<div>
{parts.map((part, index) => {
// return first element of parts array which matches node.id
// eslint-disable-next-line
const link = node.links?.find(link => link.id === part)

// if a part matches link.id, replace that part with an ExternalLink, and reconcat as node.definition
if (link) {
return (
// eslint-disable-next-line
<span>
<ExternalLink
key={index}
label={link.text}
url={link.url}
id={link.id}
></ExternalLink>
</span>
)
}
// Otherwise, return the part as is
return part
})}
</div>
)
}

LinkSection.propTypes = {
node: PropTypes.shape({
definition: PropTypes.string.isRequired,
links: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
})
),
}).isRequired,
}

export const query = graphql`
{
allGlossaryJson {
nodes {
term
definition
note
links {
id
text
url
}
}
}
image: file(relativePath: { eq: "glossary-map.jpeg" }) {
Expand All @@ -300,6 +352,13 @@ Glossary.propTypes = {
term: PropTypes.string.isRequired,
definition: PropTypes.string.isRequired,
note: PropTypes.string,
links: PropTypes.PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string,
text: PropTypes.string,
url: PropTypes.string,
})
),
})
),
}).isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/campaign/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ CampaignTemplate.propTypes = {
PropTypes.shape({
cmrTitle: PropTypes.string.isRequired,
doi: PropTypes.string.isRequired,
format: PropTypes.string,
formats: PropTypes.string,
id: PropTypes.string.isRequired,
longname: PropTypes.string,
})
Expand Down
2 changes: 1 addition & 1 deletion src/templates/instrument/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ InstrumentTemplate.propTypes = {
dois: PropTypes.arrayOf(
PropTypes.shape({
cmrTitle: PropTypes.string.isRequired,
format: PropTypes.string,
formats: PropTypes.string,
doi: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
longname: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/platform/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ PlatformTemplate.propTypes = {
dois: PropTypes.arrayOf(
PropTypes.shape({
cmrTitle: PropTypes.string.isRequired,
format: PropTypes.string,
formats: PropTypes.string,
doi: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
longname: PropTypes.string,
Expand Down

0 comments on commit 899646b

Please sign in to comment.