Giter Club home page Giter Club logo

siga-scraper's Introduction

Archived bc UTN now uses SIU Guaraní.

SIGA Scraper

Latest Stable Version

Tool to retrieve information from the SIGA FRBA UTN website.

Support

Invitame un café en cafecito.app

Instalation

npm i siga-scraper

Methods

Scrape Cursada

Method scrapeCursada : Promise<Course[]>,

Returns: Course[]

// Response example.
[
  {
    courseId: string, // Id del curso interno del SIGA
    curso: string, // Código del curso, ejemplo: K1021
    nombre: string, // Nombre del curso
    color: string, // Color del curso
    dia: number[], // Representación numérica del día de la semana.
    hora: string[], // Hora de la clase.
    horaT: string[], // Hora de finalización de la clase.
    turno: string, // 'Mañana' | 'Tarde' | 'Noche'
    aula: string, // Aula del curso.
    sede: string, // Sede en la que se dicta el curso.
  },
];

PD: El día y las horas son arrays ya que en el caso de que una asignatura se curse más de un día, se alinean los indices de los 3 arrays.

El día empieza en 1 => Lunes, hasta el 6 => Sabado, se excluye el Domingo.

Scrape Notas

Method scrapeNotas : Promise<Notas[]>,

Returns: Notas[]

// Response example.
[
  courseId: string, // Id del curso interno del SIGA
  name: string, // 'Análisis Matemático I'
  notas: [
    {
      instancia: string, // Instancia de evaluación
      calificacion: number, // Nota, 0..10, el 0 representa el ausente.
    }
  ],
];

Scrape Historial Consolidado

scrapeHistorialConsolidado() : Promise<RowEntry[]>,

Returns: RowEntry[]

// Response RowEntry example.

export interface Acta {
  sede: string;
  libro: string;
  folio: string;
  nota?: number;
}

export interface RowEntry {
  tipo: string; // 'Cursada' | 'Final';
  estado: string;
  plan: string; // Nombre del plan, ejemplo O95A (civil) o K08 (sistemas).
  courseId: string; // Id del curso interno del SIGA
  nombre: string; // Nombre del curso
  year: number; // Año de la cursada
  periodo: string; // Identificador del periodo
  fecha: string; // DD/MM/AAAA
  acta: Acta | null;
}
/*
{
  "tipo": "Final",
  "estado": "Aprob",
  "plan": "K08",
  "courseId": "950701",
  "nombre": "Álgebra y Geometría Analítica",
  "year": 2018,
  "periodo": "K08 Anual",
  "fecha": "29/11/2018",
  "acta": {
    "sede": "FRBA",
    "libro": "PR045",
    "folio": "180",
    "nota": 8
  }
}
*/

Scrape Actas de Final

scrapeActaDeFinales() : Promise<ActaFinal[]>,

Returns: ActaFinal[]

// Response example.

export interface ActaFinal {
  fecha: string;
  courseId: string;
  nombre: string;
  libro: string;
  folio: string;
  nota: number;
}

/*
  {
    "fecha": "01/01/2020",
    "courseId": "000000",
    "nombre": "Asignatura 1",
    "libro": "AA001",
    "folio": "33",
    "nota": "10"
  },
*/

Examples

QuickStart

import sigaScraper from 'siga-scraper';

async function main() {
  await sigaScraper.start();
  await sigaScraper.login(SIGA_USER, SIGA_PASS);

  const response = await sigaScraper.scrapeCursada();

  console.log(response);
  /*
  [{
    courseId: '950703',
    curso: 'Z2004',
    nombre: 'Análisis Matemático II',
    aula: '115',
    sede: 'Campus',
    color: '#7A94CF',
    turno: 'Mañana',
    dia: [3],
    hora: ['8:30'],
    horaT: ['12:30'],
  }, ...]
  */
  await sigaScraper.stop();
}

main();

Running tasks simultaneously

import sigaScraper from 'siga-scraper';

async function main() {
  await sigaScraper.start();
  await sigaScraper.login(SIGA_USER, SIGA_PASS);
  const tasksPromises = [
    sigaScraper.scrapeNotas(),
    sigaScraper.scrapeCursada(),
  ];
  const [responseNotas, responseCursada] = await Promise.all(tasksPromises);

  console.log(responseNotas); // => [ {...}, {...} ]
  console.log(responseCursada); // => [ {...}, {...} ]

  await sigaScraper.stop();
}

main();

Contribute

Pull request are open and welcome.

License

siga-scraper's People

Contributors

dependabot[bot] avatar nmigueles avatar

Watchers

 avatar

siga-scraper's Issues

[New Feature] Actas de Finales.

Scrape actas de finales.

Method scrapeActasDeFinales() : Promise<ActaFinal[]>

Debe extraer la información de esta pág:

http://siga.frba.utn.edu.ar/alu/acfin.do

Respuesta con el siguiente formato:

interface ActaFinal {
  fecha: string;
  courseId: string;
  nombre: string;
  libro: string;
  folio: string;
  nota: number;
}
// Ejemplo
[{
  fecha: '29/11/2018',
  courseId: '950702',
  nombre: 'Análisis Matemático I',
  libro: 'XX000',
  folio: '66',
  nota: 10
 }, ...]

[New feature] scrapeHistorialConsolidado

Actualmente en desarrollo.

scrapeHistorialConsolidado() : Promise<RowEntry[]>,

Returns: RowEntry[]

// Response RowEntry example.

interface Acta {
  sede: string;
  libro: string;
  folio: string;
  nota?: number;
}

interface RowEntry {
  tipo: string; // 'Cursada' | 'Final';
  estado: string;
  plan: string; // Nombre del plan, ejemplo O95A (civil) o K08 (sistemas).
  courseId: string; // Id del curso interno del SIGA
  nombre: string; // Nombre del curso
  year: number; // Año de la cursada
  periodo: string; // Identificador del periodo
  fecha: string; // DD/MM/AAAA
  acta: Acta | null;
}

[Docs] Documentar dias

Documentar como se establecen los índices para los días.

dia: [2 , 3]

Fix: Siempre devolver Array. Aunque tenga un solo elemento.

v1.2.0 Diferenciacion de métodos

En el caso de:

  • scrapeNotas, debería devolver un identificador único de la asignatura, (courseId).
  • scrapeCursada, no debería devolver la propiedad notas, ya que eso le corresponde al método scrapeNotas y además nunca se devuelve nada en dicha propiedad.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.