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

sbJson 2.0 contacts #64

Closed
2 tasks done
stansmith907 opened this issue Mar 6, 2017 · 7 comments
Closed
2 tasks done

sbJson 2.0 contacts #64

stansmith907 opened this issue Mar 6, 2017 · 7 comments

Comments

@stansmith907
Copy link
Contributor

stansmith907 commented Mar 6, 2017

Mapping of sbJson contacts to mdTranslator internal data structure:

  • reader complete
  • writer complete
{
   "contacts": [
      {
         "name": "Robert N Prescott",
         "oldPartyId": 58818,
         "type": "Distributor",
         "sourceId": "asdf",
         "contactType": "person",
         "organizationsPerson": "usgs",
         "ttyPhone": "123-123-1234",
         "hours": "8-4",
         "instructions": "test",
         "email": "[email protected]",
         "active": true,
         "jobTitle": "Computer Programmer",
         "personalTitle": "test",
         "firstName": "Robert",
         "middleName": "N",
         "lastName": "Prescott",
         "note": "note",
         "aliases": [
            "VOLCANO HAZARDS TEAM",
            "VOLCANO SCIENCE CENTER"
         ],
         "fbmsCodes": [
            "GGWAWC0000"
         ],
         "logoUrl": "http://my.usgs.gov/static-cache/images/dataOwner/v1/logosMed/USGSLogo.gif",
         "smallLogoUrl": "http://my.usgs.gov/static-cache/images/dataOwner/v1/logosSmall/USGSLogo.gif",
         "organization": {
            "displayText": "Fort Collins Science Center"
         },
         "primaryLocation": {
            "see": "sbJson 2.0 primaryLocation"
         }
      }
   ]
}

Definition: The contacts of an item. This is an collection of basic typed contact objects, which have the fields: type, name, highlighted.

Mapping...

  • new contact
    [schema][contacts][n].contactId
  • name: The name of the contact.
    Map to contacts name
    [schema][contacts][n].name
    view mdTools
  • type: An editable type to describe the person or organization.
    Map to contacts contactType
    [schema][contacts][n].contactType
    view mdTools
  • contactType: The type of contact, always "person" or "organization"
    Map to contacts isOrganization
    [schema][contacts][n].isOrganization
    view mdTools
  • ttyPhone: (none)
    Map to contacts phones
    [schema][contacts][n].[phones][n].phoneNumber
    view mdTools
    [schema][contacts][n].[phones][n][phoneServiceTypes][n]
    view mdTools
  • hour: (none)
    Map to contacts hoursOfService
    [schema][contacts][n].hoursOfService
    view mdTools
  • instructions: (none)
    Map to contacts contactInstructions
    [schema][contacts][n].contactInstructions
    view mdTools
  • email: The email address of a person. Not included in organizations
    Map to contacts eMailList
    [schema][contacts][n][eMailList][n]
    view mdTools
  • jobTitle: (none)
    Map to contacts positionName
    [schema][contacts][n].positionName
    view mdTools
  • organization.displayText: (none)
    Map to new contact
    [schema][contacts][n+1].contactId
    [schema][contacts][n+1].name
    [schema][contacts][n+1].isOrganization = true
    view mdTools
  • logoUrl: (none)
    [schema][contacts][n].[logos][n].graphicName
    view mdTools
    [schema][contacts][n].[logos][n].[graphicURI][n].uri
    view mdTools
  • smallLogoUrl: (none)
    Map to contacts logos
    [schema][contacts][n].[logos][n].graphicName
    view mdTools
    [schema][contacts][n].[logos][n].[graphicURI][n].uri
    view mdTools

Not Mapped...

  • oldPartyId
  • sourceId
  • organizationsPerson
  • active
  • personalTitle
  • firstName
  • middleName
  • lastName
  • aliases
  • fbmsCodes
  • note

Mapping to mdTranslator

   def newBase
      intObj = {
         contacts: [
            {
               contactId: 'CID001',
               isOrganization: false,
               name: 'Robert N Prescott',
               positionName: 'Computer Programmer',
               memberOfOrgs: ['CID002'],
               logos: [
                  {
                     graphicName: 'logoUrl',
                     graphicDescription: nil,
                     graphicType: nil,
                     graphicConstraints: [],
                     graphicURI: [
                        {
                           olResURI: 'http://my.usgs.gov/static-cache/images/dataOwner/v1/logosMed/USGSLogo.gif',
                           olResProtocol: nil,
                           olResName: nil,
                           olResDesc: nil,
                           olResFunction: nil
                        }
                     ]
                  },
                  {
                     graphicName: 'smallLogoUrl',
                     graphicURI: [
                        {
                           olResURI: 'http://my.usgs.gov/static-cache/images/dataOwner/v1/logosSmall/USGSLogo.gif',
                        }
                     ]
                  },
               ],
               phones: [
                  {
                     phoneName: nil,
                     phoneNumber: '123-123-1234',
                     phoneServiceTypes: ['tty']
                  }
               ],
               addresses: [],
               eMailList: ['[email protected]'],
               onlineResources: [],
               hoursOfService: ['8-4'],
               contactInstructions: 'test',
               contactType: 'Distributor'
            },
            {
               contactId: 'CID002',
               isOrganization: true,
               name: 'Fort Collins Science Center'
            }
         ]
      }
   end

Translation to mdJson

{
   "contacts": [
      {
         "contactId": "CID001",
         "isOrganization": false,
         "name": "Robert N Prescott",
         "positionName": "Computer Programmer",
         "memberOfOrganization": ["CID002"],
         "logoGraphic": [
            {
               "fileName": "logoUrl",
               "fileUri": [
                  {
                     "uri": "http://my.usgs.gov/static-cache/images/dataOwner/v1/logosMed/USGSLogo.gif"
                  }
               ]
            },
            {
               "fileName": "smallLogoUrl",
               "fileUri": [
                  {
                     "uri": "http://my.usgs.gov/static-cache/images/dataOwner/v1/logosSmall/USGSLogo.gif"
                  }
               ]
            }
         ],
         "phone": [
            {
               "phoneNumber": "123-123-1234",
               "service": ["tty"]
            }
         ],
         "address": [],
         "electronicMailAddress": ["[email protected]"],
         "hoursOfService": ["8-4"],
         "contactInstructions": "test",
         "contactType": "Distributor"
      },
      {
         "contactId": "CID002",
         "isOrganization": true,
         "name": "Fort Collins Science Center"
      }
   ]
}
@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

Just a note that the contact -> type mapping is one-way. The writer will need to determine the type by scanning the record for all instances of party (contactId + role). Each unique instance of the party will need to be included in the sbJSON contacts[ ] with type = role.

@stansmith907
Copy link
Contributor Author

I'm thinking no scanning will be necessary if a unique contact is created for each occurrence in sbJson. I find a contact, I create one, and each has a unique ID so it can find its way back. Otherwise we are making too many guesses about what contact to use in any situation.

@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

When going from mdJSON to sbJSON, you'll have to put all the unique contacts into the sbJSON contacts[ ] array. To do that the contacts will need a type which can only be obtained from the party roles. It's a PITA, but the only way to grab them all is to scan for every instance of party. Unless we just use the contacts in the citation and call it good.

@stansmith907
Copy link
Contributor Author

OK, you're talking about the type element specifically. It is very likely that in mdJson a contact will be associated with several roles (types). Since contact < type in sbJson is singular, are you thinking we need to create a new instance of contact in sbJson for each contact/role paring mdJson?

@jlblcc
Copy link
Member

jlblcc commented Mar 6, 2017

Exactly.

@stansmith907
Copy link
Contributor Author

Not sure why fbmsCodes are associated with contact. Any insight? Not that we have a place for them anyway.

@jlblcc
Copy link
Member

jlblcc commented Mar 7, 2017

Nope. Might be related to agreement #s?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants