Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

field is being repeated over and over #1

Closed
pdurbin opened this issue Jun 3, 2024 · 0 comments · Fixed by #2
Closed

field is being repeated over and over #1

pdurbin opened this issue Jun 3, 2024 · 0 comments · Fixed by #2

Comments

@pdurbin
Copy link
Member

pdurbin commented Jun 3, 2024

@goeffthomas pointed out (thanks!) that as of 0.1.1 we are repeating field over and over like this:

    "recordSet": [
        {
            "@type": "cr:RecordSet",
            "field": [
                {
                    "@type": "cr:Field",
                    "name": "make",
                    "description": "Make and Model",
                    "dataType": "sc:Text",
                    "source": {
                        "@id": "11",
                        "fileObject": {
                            "@id": "data/stata13-auto.dta"
                        }
                    }
                }
            ]
        },
        {
            "@type": "cr:RecordSet",
            "field": [
                {
                    "@type": "cr:Field",
                    "name": "price",
                    "description": "Price",
                    "dataType": "sc:Integer",
                    "source": {
                        "@id": "5",
                        "fileObject": {
                            "@id": "data/stata13-auto.dta"
                        }
                    }
                }
            ]
        },

Instead, we should emit field once like this:

    "recordSet": [
        {
            "@type": "cr:RecordSet",
            "field": [
                {
                    "@type": "cr:Field",
                    "name": "make",
                    "description": "Make and Model",
                    "dataType": "sc:Text",
                    "source": {
                        "@id": "11",
                        "fileObject": {
                            "@id": "data/stata13-auto.dta"
                        }
                    }
                },
                {
                    "@type": "cr:Field",
                    "name": "price",
                    "description": "Price",
                    "dataType": "sc:Integer",
                    "source": {
                        "@id": "5",
                        "fileObject": {
                            "@id": "data/stata13-auto.dta"
                        }
                    }
                },

That's what the spec says to do. From the spec ( https://docs.mlcommons.org/croissant/docs/croissant-spec.html#format-example ):

  "recordSet": [
    {
      "@type": "cr:RecordSet",
      "@id": "images",
      "key": { "@id": "hash" },
      "field": [
        {
          "@type": "cr:Field",
          "@id": "images/image_content",
          "description": "The image content.",
          "dataType": "sc:ImageObject",
          "source": {
            "fileSet": { "@id": "image-files" },
            "extract": {
              "fileProperty": "content"
            }
          }
        },
        {
          "@type": "cr:Field",
          "@id": "images/hash",
          "description": "The hash of the image, as computed from YFCC-100M.",
          "dataType": "sc:Text",
          "source": {
            "fileSet": { "@id": "image-files" },
            "extract": {
              "fileProperty": "filename"
            },
            "transform": {
              "regex": "([^\\/]*)\\.jpg"
            }
          }
          "references": { "@id": "metadata/hash" }
        },
        {
          "@type": "cr:Field",
          "@id": "images/date_taken",
          "description": "The date the photo was taken.",
          "dataType": "sc:Date",
          "source": { "@id": "metadata/datetaken" }
        }
      ]
    }
  ]

I'll make a pull request.

pdurbin added a commit that referenced this issue Jun 3, 2024
@pdurbin pdurbin closed this as completed in #2 Jun 3, 2024
pdurbin added a commit that referenced this issue Jun 3, 2024
stop repeating field over and over #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant