Sunday, February 16, 2020

I saw Michael Jordon speak on geofencing at AngularMN on Wednesday night.

Version 5 of Ionic came out the very day of this talk. Micronaut, as a microservices framework for Java, Groovy, and Kotlin was described as an alternative to Spring Boot. Versions 1 and 2 of CoffeeScript are apparently quite a bit different. I remember seeing, I think, Derick Bailey badmouth CoffeeScript based on the fact that you might not like the JavaScript it compiles to. I wonder if the two different versions vary in how they ultimately compile or if there are things in the first version you just cannot do in the second version. Rollbar is error logging for Python. It will send an SMS message when a new bug appears. Fantasy Strike is some sort of fighting game like Mortal Kombat. Signal.IO apparently tracks errors at the client (yes, JavaScript) and, as its npm write up suggests, it "is a realtime application framewrork for building Web API based on WebSocket instead of HTTP" complete with the framewrork typo. Catalina is the latest name for the latest version of macOS. High Sierra is a different version. El Capitan and Mountain Lion are OS X versions and OS X and Mac OS X beforehand are really just different names for what is now macOS. Universally unique identifier is what uuid stands for. Well, enough random things. I should probably talk about the talk Michael Jordon gave. This may be the last talk at virtuwell and the last monthly talk too. Michael, one of the AngularMN organizers volunteering himself as a presenter due to how hard it is to find presenters, bemoaned how hard it was to find presenters and suggested that the group may fall over to a quarterly meeting format in compensation. I suspect this particular meeting could be the last one with Black Sheep Pizza and could mark the last time, for a while, that I'll have a reason to venture into St. Paul. Michael works at Medtronic and suggested the HCU (healthcare utilization???) data is as hard to come by as speakers for his meetup and hence, Medtronic is trying to cook a lot of it up themselves with a geofence or two in the mix. If you have an implantable loop recorder (ILR) implanted in your chest broadcasting signals, maybe the device can "know" when you visited a hospital based upon the geofencing around a hospital which could be a circle with a single point and a radius or a polygon of multiple points (verities with latitude and longitude pairings) around a building. Some other characters visiting the talk had an application that probation officers used in lieu of ankle bracelets to make sure peeps on probation didn't stray out of their county. Other visitors had an inventory application telling them how far away, as a crow flies, a particular chunk of equipment was. The app didn't use Google Maps to cough up driving directions as some things, Caterpillar excavators for example, could not be moved as nimbly as a car might move. Users use "street view" in Google Maps to make judgments about obstacles for this sort of circumstance. There was some talk of what you get for free with Google Maps. For example, you get twenty fences, leading to a strategy in which nineteen fences are drawn and a twentieth fence encloses them. When your user strays beyond the twentieth fence, the nineteen closest fences are recalculated. Google Maps stay valid for up to twenty-four hours and Google gives you up to $200 of API calls for free so why not make a pool of maps in a cache and serve stuff out of your pool in the name of keeping costs down. When someone is done using a map it may just go back in your little cache for the remainder of its time to live, no? Someone suggested using layers overtop of Google Maps to manage pins or drawings. Michael, using Ionic, spun up an app he live coded with these Ionic CLI commands:

  1. ionic start geofence-demo tabs --capacitor
  2. cd geofence-demo
  3. ionic serve

 
 

So, yes, we have Capacitor in the mix here to try to have at some of the lower levels of phone, this time in the name of geolocation not, for instance, the camera. Radar is used for the geofencing itself. It has an SDK. With Radar you may have one hundred geofences for free and up to ten thousand users for free. Radar can "know" if someone is just driving through a geolocation or actually stopping there based on checks for service. This is called stop detection. There are other dev tools for detecting geolocation spoofing too. The probation guys eluded to as much. Some of Michael's Ionic markup looked like so:

<ion-header>
   <ion-toolbar color="primary">
      <ion-title>
         Fences
      </ion-title>
   </ion-toolbar>
</ion-header>
<ion-content>
   <ion-spinner style="margin: 10px auto; display: block;" *ngIf="loading"
         name="crescent"></ion-spinner>
   <ion-list>
      <ion-item *ngFor="let f of fences">
         <ion-label>
            <h2>{{f.description}}</h2>
            <p>lat: {{f.gemometryCenter.coordinates[0]}}</p>
         </ion-label>
      </ion-item>
   </ion-list>
</ion-content>

 
 

Michael said he was using webhooks out to a Heroku API. From there Twilio sends a text message. CocoaPods was being used for dependency management (think npm or NuGet only for the Mac) for Xcode to dig up the Radar stuff. You cannot just use .startTracking in Radar but instead you have to have something like .trackOnce().then((result) => { and have the .startTracking nested inside as otherwise the .startTracking won't fly. In modern Mac Safari dev tools, you may connect your phone in easily to your laptop to test on your phone, etc. Michael's TypeScript sister pairing with the markup above looked like so:

@Component({
   selector: 'app-tab3',
   templateUrl: 'tab3.page.html',
   styleUrls: ['tab3.page.scss']
})
export class Tab3Page {
   fencesPromise: Observable<any>;
   fences: any = [];
   loading: boolean = false;
   
   constructor(public httpClient: HttpClient) {
   }
   
   ionViewWillEnter() {
      this.loading = true;
      this.getFences();
   }
   
   getFences = (theclick = null) => {
      this.fences = [];
      
      const: httpOptions = {
         headers: new HttpHeaders({
            'Content-type': 'application/json',
            'Authorization': 'environment.radarKey
         })
      }
      
      this.fencesPromise = this.httpClient.get('https://api.radar.io/v1/geofences',
            httpOptions);
      
      this.fencesPromise.subscribe(data => {
         this.fences = data.geofences;
         
         if(theclick) {
            theclick.target.complete();
         }
         
         this.loading = false;
      }, error => {
         connectableObservableDescriptor.log();
         this.loading = false;
      })
   }
}

No comments:

Post a Comment