WHY ARE WE SHOUTING? Here are some random examples that a user of atc-tools
may find helpful, informative, or interesting.
As discussed elsewhere, ATC has a web application layer (what you use when you
point a web browser at ATC) and a REST application program interface (API)
layer. You should know that atc-tools
provides a Python scripting interface
to the API layer.
ATC works with documents. You can get documents from ATC. If you have the right set of permissions, you can create new documents. If you have even more permissions, you can update or even delete documents.
ATC groups documents into folders called services. I prefer the term service because the term folder makes it sound like it can only contain documents, and some services do not have any (real or virtual) documents at all, but they still do something. But the way you talk to services and get information from ATC is through documents.
The most important service is the posts
service. Documents in the posts
service have a certain structure, and at a minimum contain these fields:
_id | some crazy string generated by MongoDB
user_id | person who made the post
target_id | target the post refers to
posted | time of posting
text | verbiage for and by humans
Posts can have doodads attached to them called attachments. Attachments cannot be repeated within a single post. They are like meta-columns. An example of an attachment is a redshift. It looks like this:
spectroscopic_redshift :
value: some value
error: some error
OK? So what you do basically is put together a document (in Python, it is a
dictionary) with that stuff and then you push it to the posts
service at ATC
and it goes in.
You do not supply _id
or user_id
or posted
--- ATC labels that stuff for
you. Authentication prevents you from pretending to be someone else.
This package contains a number of useful command-line scripts. More can be written as needed. Some work anywhere, some work only at NERSC (ones that need to see the file system). Some work for anyone with an ATC developer API key, and some work only for the administrator or certain other trusted users.
The following will create a post for some targets that were identified in a particular ATEL.
atc-register-atel -c "Published in ATEL #6790." 6790 DES14C3hud DES14S1kdq
DES14S1lfk DES14X3jmx
This makes a post under each of the four targets listed with an ATEL attachment indicating these targets were published in that ATEL.
We use tags to just label stuff. Here is how we apply a QSO label to a bunch of targets.
atc-tag-simple.py apply qso DES14C3ppk DES14C3asz DES14C3cux DES14C3cwz
DES14C3cyp -c "Ryan notes long, non-periodic variability, possible qso."
This kind of tag is a simple tag, meaning it has no metadata associated with it. There are other kinds of tags that do have metadata. Simple tags can be made on the fly, but the other kind requires coordination with the server schema code.
There is a command line tool called atc
also that you can use like this:
atc get user rthomas
atc get target DES19X3blah
For all of the above scripts, you can type "command -h" to get help. And for
atc
you can even go like
atc -h
atc get -h
atc get user -h
That is great.