here-cli icon indicating copy to clipboard operation
here-cli copied to clipboard

enhance analyze, save output to space

Open burritojustice opened this issue 5 years ago • 1 comments

here xyz analyze iterates through a space and shows the frequency of values for a particular property:

$ here xyz analyze J7LtWd5Z
Operation may take a while. Please wait.........................................
? Select the properties to analyze 15 : qCaretaker : Private , Private , Private
qCaretaker
┌────────────────────────────────────────┬────────────────────────────────────────┬────────────────────────────────────────┐
│ PropertyName                           │ Value                                  │ Count                                  │
├────────────────────────────────────────┼────────────────────────────────────────┼────────────────────────────────────────┤
│ qCaretaker                             │ Private                                │ 159141                                 │
│ qCaretaker                             │ DPW                                    │ 25888                                  │
│ qCaretaker                             │ SFUSD                                  │ 1078                                   │
│ qCaretaker                             │ Port                                   │ 723                                    │
│ qCaretaker                             │ Rec/Park                               │ 720                                    │
│ qCaretaker                             │ PUC                                    │ 261                                    │
│ qCaretaker                             │ DPW for City Agency                    │ 186                                    │
│ qCaretaker                             │ MTA                                    │ 106                                    │
│ qCaretaker                             │ Purchasing Dept                        │ 85                                     │
│ qCaretaker                             │ Dept of Real Estate                    │ 85                                     │
│ qCaretaker                             │ Housing Authority                      │ 73                                     │
│ qCaretaker                             │ Fire Dept                              │ 69                                     │
│ qCaretaker                             │ Health Dept                            │ 54                                     │
│ qCaretaker                             │ Police Dept                            │ 50                                     │
│ qCaretaker                             │ Mayor Office of Housing                │ 36                                     │
│ qCaretaker                             │ Public Library                         │ 34                                     │
│ qCaretaker                             │ Arts Commission                        │ 31                                     │
│ qCaretaker                             │ Office of Mayor                        │ 26                                     │
│ qCaretaker                             │ War Memorial                           │ 20                                     │
│ qCaretaker                             │ City College                           │ 11                                     │
│ qCaretaker                             │ Asian Arts Commission                  │ 6                                      │
└────────────────────────────────────────┴────────────────────────────────────────┴────────────────────────────────────────┘

Total unique property values in space J7LtWd5Z : 

┌────────────────────────────────────────┬────────────────────────────────────────┐
│ PropertyName                           │ Count                                  │
├────────────────────────────────────────┼────────────────────────────────────────┤
│ qCaretaker                             │ 21                                     │
└────────────────────────────────────────┴────────────────────────────────────────┘
  • We should save this as an object within the client object of the space info, so it can be used for dataviz purposes.

  • if a field is quantitative, we should calculate global min, max, average, mean

  • We should run this on all properties.

  • analyze iterates through the entire space -- we should leverage the statistics endpoint so we know what properties are in the space, and create an object in client:

{
	properties:
	{
		qCaretaker:
		{	
			kind: qualitative,
			unique: 21,
			values:
			{
				Private: 
				{
					count: 159141,
					rank: 1
				},
				DPW: 
				{
					count: 25888,
					rank: 2
				},
				SFUSD:
				{ 
					count: 1078,
					rank: 3
				},
				...
				Asian Art Museum:
				{
					count: 6
					rank: 21
				}
			}
			
		},
		height:
		{
			kind: quantitative,
			max: 250,
			min: 6,
			avg: 14.7,
			mean: 30
		}
	},
	updatedAt: 12098457192
}

Applications could use rank to choose non-repetitive colors for qualitative values, and meaningful color ranges for quantitative values.

This should eventually become part of the statistics response.

burritojustice avatar Dec 19 '19 21:12 burritojustice

Could we make analyze part of upload? It could track and count unique values, and then write them to the space description when it's finished.

burritojustice avatar Jan 07 '20 22:01 burritojustice